Submission #997788

#TimeUsernameProblemLanguageResultExecution timeMemory
997788amirhoseinfar1385Carnival (CEOI14_carnival)C++17
100 / 100
17 ms344 KiB
#include<bits/stdc++.h> using namespace std; const int maxn=1000; int n,all[maxn],res[maxn],now; int main(){ // ios::sync_with_stdio(0); // cin.tie(0); // cout.tie(0); res[1]=1; now=2; cin>>n; for(int i=2;i<=n;i++){ int low=0,high=i,mid; while(high-low>1){ mid=(high+low)>>1; cout<<i-mid+1<<" "; for(int j=mid;j<=i;j++){ cout<<j<<" "; } cout<<endl; int x; cin>>x; cout<<i-mid<<" "; for(int j=mid;j<i;j++){ cout<<j<<" "; } cout<<endl; int xx; cin>>xx; if(x==xx){ low=mid; }else{ high=mid; } } if(low==0){ res[i]=now; now++; }else{ res[i]=res[low]; } } cout<<0<<" "; for(int i=1;i<=n;i++){ cout<<res[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...