Submission #166567

#TimeUsernameProblemLanguageResultExecution timeMemory
166567NaimSSCarnival (CEOI14_carnival)C++14
100 / 100
28 ms380 KiB
#include <bits/stdc++.h> using namespace std; int pai[155]; int cor[155]; void tenta(int i,int l,int r){ if(l==r){ if(l==i)return; cout<<2<<" "<<i<<" "<<l<<endl; int x; cin>>x; if(x==1)cor[l] = cor[i]; return; }else{ int m = (l+r)/2; if(l!=m){ cout<<m-l+1; for(int i=l;i<=m;i++)cout<<" "<<i; cout<<endl; int x; cin>>x; cout<<m-l+2<<" "<<i; for(int i=l;i<=m;i++)cout<<" "<<i; cout<<endl; int y; cin>>y; if(x==y){ tenta(i,l,m); } }else tenta(i,l,l); if(r!=m+1){ cout<<r-(m+1) + 1; for(int i=m+1;i<=r;i++)cout<<" "<<i; cout<<endl; int x; cin>>x; cout<<r-(m+1) + 2 <<" "<<i; for(int i=m+1;i<=r;i++)cout<<" "<<i; cout<<endl; int y; cin>>y; if(x==y){ // cout<<l<<" "<<r<<"-> "<<m+1<<" "<<r<<endl; tenta(i,m+1,r); } }else tenta(i,r,r); } } int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n; cin>>n; for(int i=1;i<=n;i++)cor[i] = -1; int cur=1; for(int i=1;i<n;i++){ if(cor[i]!=-1)continue; cor[i] = cur; tenta(i,i+1,n); cur++; } for(int i=1;i<=n;i++){ if(cor[i]==-1)cor[i]=cur++; } cout<<0; for(int i=1;i<=n;i++)cout<<" "<<cor[i]; cout<<endl; }
#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...