This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |