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 pub push_back
int n, now, bef = 1;
int ans[155];
int tanya = 0;
vector<int>q;
int main(){
cin >> n;
ans[1] = 1;
q.pub(1);
for(int i=2;i<=n;i++){
cout << q.size()+1;
for(int elm:q)
cout << " " << elm;
cout << " " << i << endl << flush;
tanya++;
cin >> now;
if(now != bef){
q.pub(i);
ans[i] = now;
}else{
int akar = sqrt(q.size())+1,
frn = -1,
sz = q.size();
int le = 0,
ri = min(le+akar-1, sz-1);
while(frn == -1){
cout << abs(le-ri)+2;
for(int j=le;j<=ri;j++)
cout << " " << q[j];
cout << " " << i << endl << flush;
tanya++;
int resp;
cin >> resp;
if(resp == abs(le-ri)+1){
for(int j=le;j<=ri && frn == -1;j++){
cout << "2 " << q[j] << " " << i << endl << flush;
tanya++;
int tmp;
cin >> tmp;
if(tmp == 1) frn = q[j];
}
}
le = ri+1;
ri = min(le+akar-1, sz-1);
}
ans[i] = ans[frn];
}
swap(now, bef);
}
assert(tanya < 1500);
cout << 0;
for(int i=1;i<=n;i++)
cout << " " << ans[i];
cout << endl << flush;
}
# | 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... |