#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 150 + 7;
bool found[N], root[N];
vector<int> same[N];
int sol[N];
int n;
int ask(vector<int> guys) {
cout << guys.size() << " ";
for (int i : guys) cout << i << " ";
cout << endl;
int res;
cin >> res;
return res;
}
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
for (int j = i + 1; j <= n; ++j) {
if (found[j] == true) continue;
vector<int> v = {i, j};
if (ask(v) == 1) {
same[i].push_back(j);
root[i] = true;
found[j] = true;
}
}
}
for (int i = 1; i <= n; ++i) if (found[i] == 0) root[i] = 1;
int c = 0;
for (int i = 1; i <= n; ++i) {
if (root[i] == 1) {
++c;
sol[i] = c;
for (auto j : same[i]) {
sol[j] = c;
}
}
}
cout << "0 ";
for (int i = 1; i <= n; ++i) cout << sol[i] << " ";
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
2 |
Partially correct |
20 ms |
344 KB |
Partially correct |
3 |
Partially correct |
52 ms |
344 KB |
Partially correct |
4 |
Partially correct |
53 ms |
344 KB |
Partially correct |
5 |
Correct |
4 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Partially correct |
18 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
15 ms |
344 KB |
Output is correct |
3 |
Partially correct |
30 ms |
596 KB |
Partially correct |
4 |
Partially correct |
55 ms |
344 KB |
Partially correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
440 KB |
Output is correct |
7 |
Correct |
7 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
440 KB |
Output is correct |
2 |
Correct |
9 ms |
344 KB |
Output is correct |
3 |
Partially correct |
41 ms |
496 KB |
Partially correct |
4 |
Partially correct |
67 ms |
344 KB |
Partially correct |
5 |
Correct |
14 ms |
344 KB |
Output is correct |
6 |
Correct |
19 ms |
596 KB |
Output is correct |
7 |
Partially correct |
50 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Partially correct |
57 ms |
756 KB |
Partially correct |
4 |
Partially correct |
62 ms |
344 KB |
Partially correct |
5 |
Correct |
17 ms |
344 KB |
Output is correct |
6 |
Partially correct |
32 ms |
344 KB |
Partially correct |
7 |
Partially correct |
29 ms |
344 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
14 ms |
344 KB |
Output is correct |
3 |
Partially correct |
42 ms |
344 KB |
Partially correct |
4 |
Partially correct |
61 ms |
516 KB |
Partially correct |
5 |
Partially correct |
36 ms |
344 KB |
Partially correct |
6 |
Partially correct |
41 ms |
344 KB |
Partially correct |
7 |
Partially correct |
44 ms |
344 KB |
Partially correct |