Submission #1113935

#TimeUsernameProblemLanguageResultExecution timeMemory
1113935Dan4LifeCarnival (CEOI14_carnival)C++17
100 / 100
16 ms616 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) using vi = vector<int>; int n, col[300]; int query(vi v){ cout << sz(v) << " "; for(auto u : v) cout << u << " "; cout << endl; int x; cin >> x; return x; } int main(){ cin >> n; vi v, w; v.pb(1); for(int i = 2; i <= n; i++){ v.pb(i); if(query(v)!=sz(v)) v.pop_back(),w.pb(i); } for(int i = 0; i < sz(v); i++) col[v[i]]=i+1; for(auto u : w){ int l = 0, r = sz(v)-1; while(l<r){ int mid = (l+r)/2; vi x; x.clear(); for(int i = 0; i <= mid; i++) x.pb(v[i]); x.pb(u); if(query(x) == sz(x)) l=mid+1; else r=mid; } col[u] = col[v[l]]; } cout << 0 << " "; for(int i = 1; i <= n; i++) cout << col[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...