Submission #978873

#TimeUsernameProblemLanguageResultExecution timeMemory
978873AcanikolicCarnival (CEOI14_carnival)C++14
0 / 100
1 ms460 KiB
#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; int ask(vector<int>st) { cout << (int)st.size() << " "; for(auto X : st) cout << X << " "; cout << endl; int x; cin >> x; return x; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,cnt = 0; cin >> n; vector<int>vec; int res[n + 1]; vec.pb(1); res[1] = ++cnt; for(int i = 2; i <= n; i++) { vec.pb(i); if(ask(vec) == (int)vec.size()) { res[i] = ++cnt; continue; }else { vec.pop_back(); int l = 0,r = (int)vec.size() - 1,ans = -1; while(l <= r) { int mid = (l + r) / 2; vector<int>v; v.pb(i); for(int j = mid; j < (int)vec.size(); j++) v.pb(vec[j]); if(ask(v) != (int)v.size()) { ans = mid; l = mid + 1; }else { r = mid - 1; } } cout << i << " " << ans << " dbg" << endl; res[i] = res[vec[ans]]; } } cout << 0 << " "; for(int i = 1; i <= n; i++) cout << res[i] << " "; cout << endl; 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...