Submission #1014389

#TimeUsernameProblemLanguageResultExecution timeMemory
1014389vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
9 ms604 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define fir first #define sec second int main(){ int n; vector<ll>v; cin >> n; vector<ll>ans(n+1); map<vector<ll>, ll>m; ll max_ = 0; for(int i = 1; i <=n; i++) { v.pb(i); int val = 0; if(!m[v]){ cout << v.size() << " "; for(int i : v) cout << i << " "; cout << endl; cin >> val; m[v]=val; } else{ val = m[v]; } if(val<=max_){ v.pop_back(); ll a=0; ll l = 0, r = v.size()-1; while(l < r){ ll mid = (l+r)/2; cout << mid +1 << " "; for(int j = 0; j <=mid; j++){ cout << v[j] << " "; } cout << endl; cin >> a; cout << mid + 2 << " "; for(int j= 0; j<=mid; j++){ cout << v[j] << " "; } cout <<i << endl; ll b =0; cin >>b; if(a==b) r= mid; else l = mid+1; } ans[i] = ans[v[l]]; } else{ max_ = val; ans[i]=max_; } } cout << 0 << " "; for(int i = 1; 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...