Submission #377505

#TimeUsernameProblemLanguageResultExecution timeMemory
377505YJUCarnival (CEOI14_carnival)C++14
100 / 100
10 ms512 KiB
#include<bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector,Ofast") using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pll; const ll MOD=1e9+7; const ll MOD2=998244353; const ll N=2e5+5; const ld pi=acos(-1); const ll INF=(1LL<<60); #define SQ(i) ((i)*(i)) #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define pb push_back #define mp make_pair #define X first #define Y second #define setp setprecision #define lwb lower_bound #define SZ(_a) (ll)_a.size() ll ans[N],n,c[N],cnt=1; ll ck(ll range,ll id){ cout<<range+1<<endl; REP1(i,range)cout<<c[i]<<" "; cout<<id<<endl; ll tmp; cin>>tmp; return tmp; } int main(){ ios_base::sync_with_stdio(0);cin.tie(0); cin>>n; REP1(i,n){ if(i==1){ans[i]=1;c[1]=i;continue;} ll l=0,r=cnt; if(ck(r,i)!=r){ans[i]=r+1;c[r+1]=i;++cnt;continue;} while(r-l>1){ ll mid=(l+r)>>1; if(ck(mid,i)==mid){ r=mid; }else{ l=mid; } } ans[i]=r;c[r]=i; } cout<<"0"; REP1(i,n)cout<<" "<<ans[i]; cout<<endl<<"\n"; 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...