Submission #103420

#TimeUsernameProblemLanguageResultExecution timeMemory
103420DiuvenCarnival (CEOI14_carnival)C++14
100 / 100
29 ms384 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...