Files
python/GESP/ShiTangPaiDui.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
484 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int n, m; // n个同学m个窗口
const int N = 100000 + 10;
vector<int> a[N];
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
int x;
cin >> x; // 表示i号同学需要加入x号窗口
a[x].push_back(i);
}
for (int i = 1; i <= m; i++) {
cout << a[i].size() << " ";
for (int j = 0; j < a[i].size(); j++)
cout << a[i][j] << " ";
cout << endl;
}
return 0;
}