Submission #918439

#TimeUsernameProblemLanguageResultExecution timeMemory
918439ayankarimovaCarnival (CEOI14_carnival)C++14
0 / 100
3 ms1232 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const ll sz=200; ll ans[sz]; map<vector<ll>, ll>mp; ll query(vector<ll>c) { if(mp[c]) return mp[c]; cout<<c.size()<<endl; for(auto i:c){ cout<<i<<' '; } cout<<endl; ll cur; cin>>cur; mp[c]=cur; return cur; } int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); ll n; cin>>n; ll cur=0; vector<ll>v; for(int i=1; i<=n; i++){ v.push_back(i); ll res=query(v); if(res>cur){ cur=res; ans[i]=cur; } else{ v.pop_back(); ll l=0, r=v.size()-1; while(l<r){ vector<ll>g; ll mid=(l+r)/2; for(int i=0; i<=mid; i++){ g.push_back(v[i]); } ll x=query(g); g.push_back(i); ll y=query(g); if(y>x){ l=mid+1; } else{ r=mid; } } ans[i]=ans[v[l]]; } } for(int i=1; i<=n; i++){ cout<<ans[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...