#include<bits/stdc++.h>
using namespace std;
#define int long long
int r;
int A[300] = {0};
int C[300] = {0};
int m = 0;
int p(int l, int r, int x) {
cout << r - l + 2 << ' ' << x << ' ';
for(int i = l; i <= r; i ++) cout << C[i] << ' ';
cout << endl;
cin >> x;
return x;
}
int32_t main () {
int n;
cin >> n;
A[1] = ++m;
C[1] = 1;
for(int i = 2;i<=n;i++) {
int N = p(1, m, i);
if(N > m) {
A[i] = ++m;C[m] = i;
}
else {
int low = 1, hight = m;
while(low < hight) {
int mid = (low+hight) >> 1;
if(p(low, mid, i) == mid + 1 - low) {
hight = mid;
}
else {
low = mid + 1;
}
}
A[i] = A[C[low]];
}
}
A[0] = 0;
for(int i = 0;i<=n;i++) {
cout<<A[i]<<' ';
}
cout<<endl;
fflush(stdout);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
200 KB |
Output is correct |
2 |
Correct |
8 ms |
200 KB |
Output is correct |
3 |
Correct |
4 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
200 KB |
Output is correct |
5 |
Correct |
3 ms |
200 KB |
Output is correct |
6 |
Correct |
4 ms |
200 KB |
Output is correct |
7 |
Correct |
9 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
200 KB |
Output is correct |
2 |
Correct |
10 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
5 ms |
200 KB |
Output is correct |
5 |
Correct |
8 ms |
200 KB |
Output is correct |
6 |
Correct |
7 ms |
200 KB |
Output is correct |
7 |
Correct |
9 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Output is correct |
2 |
Correct |
5 ms |
200 KB |
Output is correct |
3 |
Correct |
7 ms |
200 KB |
Output is correct |
4 |
Correct |
4 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 |
9 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
200 KB |
Output is correct |
2 |
Correct |
7 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
4 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 |
8 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
200 KB |
Output is correct |
2 |
Correct |
10 ms |
200 KB |
Output is correct |
3 |
Correct |
8 ms |
200 KB |
Output is correct |
4 |
Correct |
6 ms |
200 KB |
Output is correct |
5 |
Correct |
6 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
3 ms |
200 KB |
Output is correct |