Submission #670948

#TimeUsernameProblemLanguageResultExecution timeMemory
670948jovian_aapCarnival (CEOI14_carnival)C++17
0 / 100
21 ms280 KiB
#include <bits/stdc++.h> using namespace std; const int maxx = 1e9+900; bool flag(int x, int y, int z) { cout << y - x + 1 << ' '; for (int i = x; i < y; ++i) { cout << i + 1 << ' '; } cout << z + 1 << endl; int h1; cin >> h1; cout << y - x << ' '; for (int i = x; i < y; ++i) { cout << i + 1 << ' '; } int h2; cin >> h2; return (h1 == h2); } int valueof(int x, int y, int z) { if (!flag(x, y, z)) { return maxx; } while (y - 1 > 1) { int m = (x + y)/2; if (flag(x, m, z)) { y = m; } else { x = m; } } return x; } vector<int> solve(int n) { int v = 2; vector<int> ans; ans.push_back(1); for (int i = 1; i < n; ++i) { int j = valueof(0, i, i); if (j == maxx) { ans.push_back(v); v++; } else { ans.push_back(ans[j]); } } return ans; } int main() { int n; cin >> n; vector<int> ans = solve(n); cout << 0 << ' '; for (int i = 0; i < n; ++i) { cout << ans[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...