#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
int n;
cin >> n;
int id[n+1];
int last = 2;
id[1] = 1;
for(int i = 2; i <= n; i++) {
int L = 1, R = i-1, ans = -1;
//cout << i << ":\n";
while(L <= R) {
//cout << L << " " << R << "\n\n\n";
int mid = ceil((double) (L + R) / 2);
int with, without;
cout << R - mid + 1 << " ";
for(int j = mid; j <= R; j++) {
cout << j << " ";
}
fflush(stdout);
cin >> without;
cout << R - mid + 2 << " ";
for(int j = mid; j <= R; j++) {
cout << j << " ";
}
cout << i << " ";
fflush(stdout);
cin >> with;
if (with == without) {
ans = R;
R = mid - 1;
} else {
ans = L;
L = mid + 1;
}
}
cout << "2 " << i << " " << id[ans] << " ";
fflush(stdout);
int check;
cin >> check;
if (check == 2) {
ans = last++;
}
id[i] = ans;
}
cout << "0 ";
for(int i = 1; i <= n; i++) {
cout << id[i] << " ";
}
fflush(stdout);
return 0;
}
//~ check for overflows
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
364 KB |
Integer 12 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
364 KB |
Integer 6 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
384 KB |
Output is correct |
2 |
Incorrect |
19 ms |
360 KB |
Integer 9 violates the range [1, 8] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
364 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
364 KB |
Integer 3 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |