#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int n, costumes[200];
vi distincts;
int main() {
//ios_base::sync_with_stdio(0);
//cin.tie(0);
memset(costumes, -1, sizeof costumes);
cin >> n;
costumes[1] = 0;
distincts = {1};
for (int i = 2; i <= n; i++) {
cout << (int)distincts.size() + 1;
for (int ele : distincts) cout << ' ' << ele;
cout << ' ' << i << endl;
int c;
cin >> c;
if (c == (int)distincts.size() + 1) {
costumes[i] = (int)distincts.size();
distincts.push_back(i);
} else {
// binary search
int l = 0, r = (int)distincts.size() - 1;
while (l < r) {
int mid = (l + r) / 2;
cout << mid - l + 2;
for (int j = l; j <= mid; j++) cout << ' ' << distincts[j];
cout << ' ' << i << endl;
cin >> c;
if (c == mid - l + 2) l = mid + 1;
else r = mid;
}
assert(l == r);
costumes[i] = l;
}
}
cout << 0;
for (int i = 1; i <= n; i++) cout << ' ' << costumes[i] + 1;
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
200 KB |
Output is correct |
2 |
Correct |
8 ms |
200 KB |
Output is correct |
3 |
Correct |
3 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
292 KB |
Output is correct |
5 |
Correct |
5 ms |
200 KB |
Output is correct |
6 |
Correct |
3 ms |
200 KB |
Output is correct |
7 |
Correct |
3 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
200 KB |
Output is correct |
2 |
Correct |
8 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
200 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
6 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
4 ms |
200 KB |
Output is correct |
3 |
Correct |
9 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
200 KB |
Output is correct |
5 |
Correct |
6 ms |
200 KB |
Output is correct |
6 |
Correct |
8 ms |
200 KB |
Output is correct |
7 |
Correct |
8 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
200 KB |
Output is correct |
2 |
Correct |
6 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
292 KB |
Output is correct |
5 |
Correct |
6 ms |
200 KB |
Output is correct |
6 |
Correct |
4 ms |
200 KB |
Output is correct |
7 |
Correct |
9 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
7 ms |
200 KB |
Output is correct |
3 |
Correct |
7 ms |
200 KB |
Output is correct |
4 |
Correct |
6 ms |
200 KB |
Output is correct |
5 |
Correct |
5 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
6 ms |
200 KB |
Output is correct |