Submission #908698

#TimeUsernameProblemLanguageResultExecution timeMemory
908698vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
9 ms1208 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; //vector<int> HIDDEN = {1, 2, 1, 3, 2}; int ask(vector<int> guys) { cout << guys.size() << " "; for (auto i : guys) cout << i << " "; /** cout << endl; set<int> s; for (auto i : guys) s.insert(HIDDEN[i - 1]); return s.size(); **/ int res; cin >> res; return res; } int main() { cin >> n; vector<int> sol(n + 1); int cnt = 1; sol[1] = 1; vector<int> full; vector<int> pref; full.push_back(1); pref.push_back(1); for (int i = 2; i <= n; ++i) { int x = ask(full); full.push_back(i); if (ask(full) == x + 1) { sol[i] = ++cnt; pref.push_back(cnt); continue; } int l = 1, r = i - 1, ans = 0; while (l <= r) { int m = (l + r) / 2; vector<int> query; query.push_back(i); for (int j = 1; j <= m; ++j) { query.push_back(j); } if (ask(query) == pref[m - 1] + 1) { l = m + 1; ans = m; } else { r = m - 1; } } sol[i] = sol[ans + 1]; pref.push_back(cnt); } cout << "0 "; for (int i = 1; i <= n; ++i) cout << sol[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...