Submission #350554

#TimeUsernameProblemLanguageResultExecution timeMemory
350554Bill_00Carnival (CEOI14_carnival)C++14
100 / 100
33 ms492 KiB
#include <bits/stdc++.h> #define pb push_back #define ff first #define ss second #define N 1000000 typedef long long ll; using namespace std; int color[N],k=0,p; vector<int>v; int interact(int l,int r,int u=0){ int y=0; if(u!=0) y++; cout << r-l+1+y << ' '; for(int i=l;i<=r;i++){ cout << i << ' '; } if(u!=0) cout << u; cout << endl; cin >> p; return p; } void solve(int l,int m,int r,int t){ if(l==m){ int c=interact(l,m); int d=interact(l,m,t); if(c==d){ color[t]=color[l]; } else color[t]=color[l+1]; return; } int c=interact(l,m); int d=interact(l,m,t); if(c==d){ int x=(l+m)>>1; solve(l,x,m,t); } else{ int x=(m+1+r)>>1; solve(m+1,x,r,t); } } int main(){ int n; cin >> n; color[1]=1; k++; for(int i=2;i<=n;i++){ int c=interact(1,i-1); v.pb(i); int d=interact(1,i); if(d>c){ k++; color[i]=k; } else{ int m=(1+(i-1))>>1; solve(1,m,i-1,i); } } cout << 0 << ' '; for(int i=1;i<=n;i++){ cout << color[i] << ' '; } 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...