# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
364768 | 2021-02-10T01:22:27 Z | ijxjdjd | Carnival (CEOI14_carnival) | C++14 | 7 ms | 364 KB |
#include <bits/stdc++.h> #define FR(i, N) for (int i = 0; i < int(N); i++) #define all(x) begin(x), end(x) using namespace std; using ll = long long; int query(vector<int> q) { cout << q.size() << " "; for (int a : q) { cout << a << " "; } cout << endl; int x; cin >> x; return x; } vector<int> merge(vector<vector<int>>& groups, int i) { vector<int> res; FR(j, i) { res.insert(res.end(), all(groups[j])); } return res; } int main() { cin.tie(0); cin.sync_with_stdio(0); int N; cin >> N; vector<vector<int>> groups; groups.emplace_back(); groups[0].push_back(1); vector<int> tot; tot.push_back(1); int ans[N]; ans[0] = 1; for (int i = 2; i <= N; i++) { tot.push_back(i); if (query(tot) == groups.size() + 1) { groups.emplace_back(); groups[groups.size()-1].push_back(i); ans[i-1] = groups.size(); } else { int low = 0; int high = groups.size()-1; while (low < high) { int mid = (low + high)/2; if (query(merge(groups, mid+1)) == mid+1) { high = mid; } else { low = mid+1; } } ans[i-1] = high+1; groups[high].push_back(i); } } cout << 0 << " "; FR(i,N) { cout << ans[i] << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 364 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 364 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 364 KB | Output is correct |
2 | Incorrect | 7 ms | 364 KB | Incorrect |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 364 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 364 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |