Submission #994156

#TimeUsernameProblemLanguageResultExecution timeMemory
994156SharkyCarnival (CEOI14_carnival)C++17
100 / 100
5 ms600 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() int query(vector<int>& v) { cout << sz(v) << ' '; for (auto& i : v) cout << i << ' '; cout << endl; int x; cin >> x; return x; } int main() { int n, id = 1; cin >> n; vector<int> st = {1}, mp(n+1, 0); mp[1] = 1; for (int i = 2; i <= n; i++) { st.push_back(i); if (query(st) == sz(st)) mp[i] = ++id; else { st.pop_back(); vector<int> v = st; while (sz(v) > 1) { int k = sz(v); vector<int> l; for (int j = 0; j < k / 2; j++) l.push_back(v[j]); l.push_back(i); if (query(l) == sz(l)) { vector<int> tmp; for (int j = k / 2; j < k; j++) tmp.push_back(v[j]); v = tmp; } else { v = l; v.pop_back(); } } mp[i] = mp[v[0]]; } } cout << "0 "; for (int i = 1; i <= n; i++) cout << mp[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...