# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752644 | 2023-06-03T11:11:12 Z | benjaminkleyn | Carnival (CEOI14_carnival) | C++17 | 5 ms | 208 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; bool done[150]; int val[150]; int query(const vector<int> &peoples, int l = 0, int r = 149, int extra = -1) { cout << min((int)peoples.size(), r + 1) - l + (extra != -1); for (int i = l; i <= r && i < peoples.size(); i++) cout << ' ' << peoples[i] + 1; if (extra != -1) cout << ' ' << extra + 1; cout << '\n'; cout.flush(); int result; cin >> result; return result; } int main() { cin.tie(0)->sync_with_stdio(0); cin >> n; vector<int> a = {0}; done[0] = true; int cur = 1; for (int i = 1; i < n; i++) { a.push_back(i); if (query(a) > cur) cur++, done[i] = true; else a.pop_back(); } int c = 0; for (int i : a) val[i] = c++; for (int i = 0; i < n; i++) if (!done[i]) { // binary search in a to find the same costume. int lo = 0, hi = c - 1, mid; while (lo < hi) { mid = (lo + hi) / 2; if (query(a, lo, mid, i) == mid - lo + 1) hi = mid; else lo = mid + 1; } val[i] = val[a[lo]]; } for (int i = 0; i < n; i++) cout << val[i] + 1 << ' '; cout << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 208 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 208 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 208 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 208 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 208 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |