Submission #908396

#TimeUsernameProblemLanguageResultExecution timeMemory
90839612345678Carnival (CEOI14_carnival)C++17
0 / 100
11 ms716 KiB
#include <bits/stdc++.h> using namespace std; const int nx=155; int n, ans[nx], res, cnt; int query(vector<int> v) { cout<<v.size()<<' '; for (auto x:v) cout<<x<<' '; cout<<endl; cin>>res; return res; } int in(int idx, int l, int r) { if (r<l) return 0; vector<int> qrs; for (int i=l; i<=r; i++) qrs.push_back(i); auto sv=query(qrs); qrs.push_back(idx); return sv==query(qrs); } int search(int idx, int l, int r) { if (l==r) return l; int md=(l+r)/2; if (in(idx, l, md)) return search(idx, l, md); else return search(idx, md+1, r); } int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n; for (int i=1; i<=n; i++) { if (!in(i, i+1, n)) ans[i]=++cnt; else { int vl=search(i, i+1, n); if (!ans[i]) ans[i]=ans[vl]=++cnt; else ans[vl]=ans[i]; } } cout<<0<<' '; for (int i=1; i<=n; i++) cout<<ans[i]; 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...