Submission #995995

#TimeUsernameProblemLanguageResultExecution timeMemory
995995vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
7 ms344 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n; int call(){ int x; cin>>x; return x; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tmp=0; cin>>n; vector<int> v(n+1,0),res(n+1,0); for(int i=1;i<=n;i++){ cout<<i; for(int j=1;j<=i;j++) cout<<" "<<j; cout<<endl; int x=call(); if(x>tmp){ tmp++; v[tmp]=i; res[i]=tmp; } } for(int i=1;i<=n;i++){ if(res[i]==0){ int l=1,r=tmp,idx=-1; while(l<=r){ int m=(l+r)/2; cout<<m+1<<" "<<i; for(int j=1;j<=m;j++) cout<<" "<<v[j]; cout<<endl; int x=call(); if(x>m) l=m+1; else{ idx=m; r=m-1; } } res[i]=idx; } } for(int i=0;i<=n;i++) cout<<res[i]<<" "; }
#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...