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 <iostream>
using namespace std;
int ask(int s, int e){
cout<<e-s+1<<' ';
for(int i=s; i<=e; i++) cout<<i<<' ';
cout<<endl;
int ans; cin>>ans;
return ans;
}
int main(){
int n, m=0; cin>>n;
int C[151]={};
C[1]=++m;
for(int i=2; i<=n; i++){
if(ask(1,i)==ask(1,i-1)+1){
C[i] = ++m;
} else {
int s=1, e=i-1;
while(s<e){
int mid = (s+e+1)/2;
if(ask(mid, i)==ask(mid, i-1)+1) e=mid-1;
else s=mid;
}
C[i] = C[s];
}
}
cout<<0<<' ';
for(int i=1; i<=n; i++) cout<<C[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... |