Submission #534650

#TimeUsernameProblemLanguageResultExecution timeMemory
534650haxormanCarnival (CEOI14_carnival)C++14
0 / 100
6 ms316 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 157; int ans[mxN]; vector<int> c[mxN]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int cur = 1; ans[1] = cur; c[cur].push_back(1); for (int i = 2; i <= n; ++i) { cout << cur + 1 << ' '; for (int j = 1; j <= cur; ++j) { cout << c[j].back() << ' '; } cout << i << endl; int num; cin >> num; if (num == cur + 1) { ans[i] = ++cur; c[cur].push_back(i); continue; } int l = 1, r = cur; while (l <= r) { int mid = (l + r) / 2; cout << mid + 1 << ' '; for (int j = 1; j <= mid; ++j) { cout << c[j].back() << ' '; } cout << i << endl; cin >> num; if (num == 1) { ans[i] = mid; c[mid].push_back(i); break; } if (num == mid + 1) { l = mid + 1; } else { r = mid - 1; } } } cout << "0 "; for (int i = 1; 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...