Submission #702803

#TimeUsernameProblemLanguageResultExecution timeMemory
702803siewjhCarnival (CEOI14_carnival)C++17
100 / 100
13 ms208 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int nums; cin >> nums; vector<int> ans(nums + 1), ind(nums + 1); ans[1] = 1; ind[1] = 1; int curr = 1; for (int i = 2; i <= nums; i++){ int w, wo; cout << i << ' '; for (int j = 1; j <= i; j++) cout << j << ' '; cout << endl; cin >> w; cout << i - 1 << ' '; for (int j = 1; j < i; j++) cout << j << ' '; cout << endl; cin >> wo; if (w > wo){ curr++; ans[i] = curr; ind[curr] = i; continue; } int l = 1, r = curr; while (l <= r){ if (l == r) break; int m = (l + r) >> 1; int num = m - l + 1; cout << num + 1 << ' '; for (int j = l; j <= m; j++) cout << ind[j] << ' '; cout << i << endl; cin >> w; if (w > num) l = m + 1; else r = m; } ans[i] = l; } cout << 0 << ' '; for (int i = 1; i <= nums; i++) cout << ans[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...