Submission #422549

#TimeUsernameProblemLanguageResultExecution timeMemory
422549Emin2004Carnival (CEOI14_carnival)C++14
100 / 100
9 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pii pair <int, int> #define pb push_back #define F first #define S second #define ll long long #define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define M_PI 3.14159265358979323846 const int N = 200005; const int mod = 1e9 + 7; int ans[N]; int main() { int n, kind = 2; cin >> n; set<int> dif; dif.insert(1); ans[1] = 1; for(int i = 2; i <= n; i++){ int m = dif.size() + 1; vector<int> v; cout << m << " " << i << " "; for(auto itr = dif.begin(); itr != dif.end(); itr++){ cout << *itr << " "; v.pb(*itr); } cout << endl; cout.flush(); int x; cin >> x; if(x == m){ ans[i] = kind; kind++; dif.insert(i); continue; } int l = 0, r = m - 2; while(l < r){ int mid = (l + r) / 2; int sz = mid - l + 1; cout << sz + 1 << " " << i << " "; for(int j = l; j <= mid; j++){ cout << v[j] << " "; } cout << endl; cout.flush(); int q; cin >> q; if(q == sz){ r = mid; } else{ l = mid + 1; } } ans[i] = ans[v[l]]; } cout << "0 "; for(int i = 1; i <= n; i++) cout << ans[i] << " "; cout.flush(); }
#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...