# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995853 | 2024-06-10T02:53:47 Z | cowwycow | Carnival (CEOI14_carnival) | C++17 | 86 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; #define name "aaaaaa" using ll = long long; using pii = pair<ll, ll>; void file(){ } const int maxn = 155; int ask(vector<int> a){ cout << a.size() << ' '; for(int i : a){ cout << i << ' '; } cout << endl; int x; cin >> x; return x; } int ans[maxn]; vector<int> b; void solve (){ int n; cin >> n; ans[1] = 1; b.push_back(1); for(int i = 2; i <= n; i++){ vector<int> cur = b; cur.push_back(i); if(ask(cur) == cur.size() + 1){ b.push_back(i); ans[i] = b.size(); }else{ int l = 0, r = b.size() - 1, mid, sus = -1; while(l <= r){ mid = (l + r) / 2; cur.clear(); for(int j = l; j <= mid; l++){ cur.push_back(b[j]); } cur.push_back(i); if(ask(cur) == mid - l + 1){ sus = mid; r = mid - 1; }else{ l = mid + 1; } } ans[i] = ans[b[sus]]; } } cout << 0 << ' '; for(int i = 1; i <= n; i++){ cout << ans[i] << ' '; } } int main(){ file(); solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 76 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 79 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 75 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 86 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 75 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |