#include <bits/stdc++.h>
using namespace std;
int main(){
int nums; cin >> nums;
vector<int> ans(nums + 1), ind(nums + 1);
ans[1] = 1; ind[1] = 1;
int curr = 1;
for (int i = 2; i <= nums; i++){
int w, wo;
cout << i << ' ';
for (int j = 1; j <= i; j++) cout << j << ' ';
cout << endl;
cin >> w;
cout << i - 1 << ' ';
for (int j = 1; j < i; j++) cout << j << ' ';
cout << endl;
cin >> wo;
if (w > wo){
curr++;
ans[i] = curr;
ind[curr] = i;
continue;
}
int l = 1, r = curr;
while (l <= r){
if (l == r) break;
int m = (l + r) >> 1;
int num = m - l + 1;
cout << num + 1 << ' ';
for (int j = l; j <= m; j++) cout << ind[j] << ' ';
cout << i << endl;
cin >> w;
if (w > num) l = m + 1;
else r = m;
}
ans[i] = l;
}
cout << 0 << ' ';
for (int i = 1; i <= nums; i++) cout << ans[i] << ' ';
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
208 KB |
Output is correct |
3 |
Correct |
10 ms |
208 KB |
Output is correct |
4 |
Correct |
5 ms |
208 KB |
Output is correct |
5 |
Correct |
8 ms |
208 KB |
Output is correct |
6 |
Correct |
6 ms |
208 KB |
Output is correct |
7 |
Correct |
7 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
208 KB |
Output is correct |
2 |
Correct |
9 ms |
208 KB |
Output is correct |
3 |
Correct |
6 ms |
208 KB |
Output is correct |
4 |
Correct |
5 ms |
208 KB |
Output is correct |
5 |
Correct |
8 ms |
208 KB |
Output is correct |
6 |
Correct |
10 ms |
208 KB |
Output is correct |
7 |
Correct |
7 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
9 ms |
208 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
9 ms |
208 KB |
Output is correct |
6 |
Correct |
9 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
208 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
208 KB |
Output is correct |
4 |
Correct |
6 ms |
208 KB |
Output is correct |
5 |
Correct |
10 ms |
208 KB |
Output is correct |
6 |
Correct |
7 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
208 KB |
Output is correct |
2 |
Correct |
12 ms |
208 KB |
Output is correct |
3 |
Correct |
13 ms |
208 KB |
Output is correct |
4 |
Correct |
9 ms |
208 KB |
Output is correct |
5 |
Correct |
9 ms |
208 KB |
Output is correct |
6 |
Correct |
6 ms |
208 KB |
Output is correct |
7 |
Correct |
5 ms |
208 KB |
Output is correct |