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>
#define int long long
// #define endl '\n'
using namespace std;
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
vector<int>v(n+1);
vector<int>vct(n+1);
vct[1]=1;
v[1]=1;
int cnt=1;
for(int i=2;i<=n;i++){
int l=1,r=cnt,mid,f=0;
while(l<=r){
mid=(l+r)/2;
cout<<mid+1<<' ';
for(int w=1;w<=mid;w++)cout<<v[w]<<' ';
cout<<i<<' ';
cout<<endl;
int x;
cin>>x;
if(x==mid){f=mid;r=mid-1;}
else l=mid+1;
}
if(f==0){
cnt++;
v[cnt]=i;
vct[i]=cnt;
}else{
vct[i]=f;
}
}
for(auto i:vct)cout<<i<<' ';
}
# | 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... |