#include <bits/stdc++.h>
using namespace std;
int n;
int ans[155];
int first[155];
inline int query(int n){
cout << n << " ";
for (int i = 1; i <= n; i++) cout << i << " ";
cout << endl;
int ans;
cin >> ans;
return ans;
}
inline int query(int s, int e){
cout << e-s+1 << " ";
for (int i = s; i <= e; i++) cout << first[i] << " ";
cout << endl;
int ans;
cin >> ans;
return ans;
}
inline int query(int x, int s, int e){
cout << e-s+2 << " ";
cout << x << " ";
for (int i = s; i <= e; i++) cout << first[i] << " ";
cout << endl;
int ans;
cin >> ans;
return ans;
}
int main(){
cin >> n;
int cur = 1;
first[1] = 1;
ans[1] = 1;
int last = 1;
for (int i = 2; i <= n; i++){
int qf = query(i);
if (qf == last){
int lo = 1, hi = cur;
while (lo+1 < hi){
int mid = (lo+hi)/2;
if (query(i,lo,mid) == query(lo,mid)){
hi = mid;
}
else{
lo = mid;
}
}
if (lo + 1 == hi){
if (query(i,lo,lo) == 1){
hi = lo;
}
else lo = hi;
}
ans[i] = lo;
}
else{
cur++;
ans[i] = cur;
first[cur] = i;
}
last = qf;
}
cout << "0 ";
for (int i = 1; i <= n; i++) cout << ans[i] << " ";
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
248 KB |
Output is correct |
2 |
Correct |
21 ms |
376 KB |
Output is correct |
3 |
Correct |
11 ms |
376 KB |
Output is correct |
4 |
Correct |
6 ms |
248 KB |
Output is correct |
5 |
Correct |
7 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
252 KB |
Output is correct |
7 |
Correct |
17 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
248 KB |
Output is correct |
2 |
Correct |
22 ms |
248 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
8 ms |
376 KB |
Output is correct |
5 |
Correct |
14 ms |
248 KB |
Output is correct |
6 |
Correct |
11 ms |
252 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
14 ms |
376 KB |
Output is correct |
3 |
Correct |
16 ms |
248 KB |
Output is correct |
4 |
Correct |
7 ms |
376 KB |
Output is correct |
5 |
Correct |
14 ms |
252 KB |
Output is correct |
6 |
Correct |
8 ms |
376 KB |
Output is correct |
7 |
Correct |
17 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
248 KB |
Output is correct |
2 |
Correct |
12 ms |
248 KB |
Output is correct |
3 |
Correct |
10 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
9 ms |
252 KB |
Output is correct |
6 |
Correct |
15 ms |
248 KB |
Output is correct |
7 |
Correct |
16 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
376 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
27 ms |
380 KB |
Output is correct |
4 |
Correct |
7 ms |
376 KB |
Output is correct |
5 |
Correct |
15 ms |
376 KB |
Output is correct |
6 |
Correct |
9 ms |
252 KB |
Output is correct |
7 |
Correct |
6 ms |
248 KB |
Output is correct |