#include <bits/stdc++.h>
using namespace std;
#define SIZE(x) (int)x.size()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define pb push_back
typedef vector<int> vi;
int query(vi &a) {
if(SIZE(a)<=1) return SIZE(a);
cout << SIZE(a) << ' ';
forn(i,SIZE(a)) cout << a[i] << ' ';
cout << endl;
int C;
cin >> C;
return C;
}
int main() {
int n; cin >> n;
int prev = 0;
vi c, pref;
vi ans(n);
forn(i,n) {
pref.pb(i+1);
int curr=query(pref);
if(curr!=prev) {
c.pb(i+1);
ans[i]=SIZE(c);
} else {
int l=0, r=SIZE(c);
while(l+1<r) {
int m=(l+r)/2;
vi q(c.begin(),c.begin()+m);
q.pb(i+1);
if(query(q)==m) r=m;
else l=m;
}
ans[i]=r;
}
prev=curr;
}
cout << "0 ";
forn(i,n) cout << ans[i] << ' ';
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
428 KB |
Output is correct |
2 |
Correct |
3 ms |
436 KB |
Output is correct |
3 |
Correct |
3 ms |
688 KB |
Output is correct |
4 |
Correct |
2 ms |
436 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
2 ms |
436 KB |
Output is correct |
7 |
Correct |
3 ms |
436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
436 KB |
Output is correct |
2 |
Correct |
4 ms |
432 KB |
Output is correct |
3 |
Correct |
2 ms |
688 KB |
Output is correct |
4 |
Correct |
2 ms |
692 KB |
Output is correct |
5 |
Correct |
3 ms |
436 KB |
Output is correct |
6 |
Correct |
3 ms |
436 KB |
Output is correct |
7 |
Correct |
4 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
436 KB |
Output is correct |
2 |
Correct |
3 ms |
436 KB |
Output is correct |
3 |
Correct |
4 ms |
692 KB |
Output is correct |
4 |
Correct |
2 ms |
688 KB |
Output is correct |
5 |
Correct |
3 ms |
436 KB |
Output is correct |
6 |
Correct |
3 ms |
432 KB |
Output is correct |
7 |
Correct |
4 ms |
688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
432 KB |
Output is correct |
2 |
Correct |
4 ms |
440 KB |
Output is correct |
3 |
Correct |
3 ms |
700 KB |
Output is correct |
4 |
Correct |
2 ms |
696 KB |
Output is correct |
5 |
Correct |
3 ms |
428 KB |
Output is correct |
6 |
Correct |
3 ms |
436 KB |
Output is correct |
7 |
Correct |
4 ms |
436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
436 KB |
Output is correct |
2 |
Correct |
5 ms |
432 KB |
Output is correct |
3 |
Correct |
4 ms |
952 KB |
Output is correct |
4 |
Correct |
3 ms |
692 KB |
Output is correct |
5 |
Correct |
3 ms |
436 KB |
Output is correct |
6 |
Correct |
4 ms |
440 KB |
Output is correct |
7 |
Correct |
2 ms |
436 KB |
Output is correct |