Submission #110513

#TimeUsernameProblemLanguageResultExecution timeMemory
110513ckodserCarnival (CEOI14_carnival)C++14
100 / 100
25 ms432 KiB
#include<bits/stdc++.h> #define ll int #define pb push_back #define mp make_pair #define ld long double #define F first #define S second #define pii pair<ll,ll> using namespace :: std; const ll mod=1e9+7; const ll maxn=200; const ll inf=1e9+900; bool is_ther(ll l,ll r,ll x){ cout<<r-l+1<<' ';; for(ll i=l;i<r;i++){ cout<<i+1<<' '; } cout<<x+1<<endl; ll v; cin>>v; cout<<r-l<<' ';; for(ll i=l;i<r;i++){ cout<<i+1<<' '; } ll vv; cin>>vv; return (v==vv); } ll find_val(ll l,ll r,ll x){ if(!is_ther(l,r,x)){ return inf; } while(r-l>1){ ll mid=(l+r)/2; if(is_ther(l,mid,x)){ r=mid; }else{ l=mid; } } return l; } vector<ll> solve(ll n){ vector<ll> ans; ans.pb(1); ll cnt=2; for(ll i=1;i<n;i++){ ll u=find_val(0,i,i); if(u==inf){ ans.pb(cnt); cnt++; }else{ ans.pb(ans[u]); } } return ans; } int main(){ ll n; cin>>n; vector<ll> ans=solve(n); cout<<0<<' '; for(ll i=0;i<n;i++){ cout<<ans[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...