Submission #908833

#TimeUsernameProblemLanguageResultExecution timeMemory
908833vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
12 ms344 KiB
#include <bits/stdc++.h> using namespace std; long long n, arr[100005], brr[100005], xd, k,zd; void BB(int a, int b){ if(a>=b)return; //cout<<xd<<"\n"; int c=(a+b+1)/2, x, y; if(c-a==1){ x=1; } else{ cout<<c-a<<' '; for(int i=a; i<c; i++)cout<<i<<' '; cout<<endl; cin>>x; } cout<<c-a+1<<' '; for(int i=a; i<c; i++)cout<<i<<' '; cout<<xd<<endl; cin>>y; if(c-a==1&&x==y){ arr[xd]=arr[a]; return; } if(x==y){ BB(a,c); return; } BB(c,b); } int main(){ cin>>n; arr[1]=brr[1]=1;zd=2; for(int i=2; i<=n; i++){ cout<<i<<' '; for(int j=1; j<=i; j++)cout<<j<<' '; cout<<endl; cin>>k; brr[i]=brr[i-1]; if(k==brr[i]+1){ brr[i]++; arr[i]=zd; zd++; continue; } xd=i; BB(1, i); } cout<<"0 "; for(int j=1; j<=n; j++)cout<<arr[j]<<' '; 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...