# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
74446 | 2018-09-01T19:54:58 Z | shoemakerjo | Carnival (CEOI14_carnival) | C++14 | 10 ms | 584 KB |
#include <bits/stdc++.h> using namespace std; #define maxn 155 int N; int ans[maxn]; vector<int> oq; int query(vector<int> stuff, int val) { cout << stuff.size() + 1 << " "; for (int vv : stuff) cout << vv << " "; cout << val << endl; int ss ; cin >> ss; return ss; } int main() { cin >> N; ans[1] = 1; oq.push_back(1); for (int i = 2; i <= N; i++) { int cur = query(oq, i); if (cur == oq.size()+1) { ans[i] = oq.size()+1; oq.push_back(i); continue; } int l = 0; int r= oq.size()-1; while (l != r) { int mid = (l+r)/2; vector<int> vc; for (int i = l; i <= mid; i++) { vc.push_back(oq[i]); } int cans = query(vc, i); if (cans == vc.size()) { //match is in here r = mid; } else { l = mid+1; } } // cout << i << " " << "l: " << l << endl; ans[i] = ans[oq[l]]; } cout << 0; for (int i = 1; i <= N; i++) { cout << " " << ans[i]; } cout << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 280 KB | Output is correct |
2 | Correct | 8 ms | 328 KB | Output is correct |
3 | Correct | 5 ms | 532 KB | Output is correct |
4 | Correct | 5 ms | 532 KB | Output is correct |
5 | Correct | 3 ms | 532 KB | Output is correct |
6 | Correct | 4 ms | 532 KB | Output is correct |
7 | Correct | 6 ms | 532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 532 KB | Output is correct |
2 | Correct | 10 ms | 532 KB | Output is correct |
3 | Correct | 5 ms | 536 KB | Output is correct |
4 | Correct | 4 ms | 540 KB | Output is correct |
5 | Correct | 7 ms | 552 KB | Output is correct |
6 | Correct | 7 ms | 552 KB | Output is correct |
7 | Correct | 8 ms | 552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 552 KB | Output is correct |
2 | Correct | 8 ms | 552 KB | Output is correct |
3 | Correct | 6 ms | 552 KB | Output is correct |
4 | Correct | 4 ms | 552 KB | Output is correct |
5 | Correct | 7 ms | 552 KB | Output is correct |
6 | Correct | 7 ms | 552 KB | Output is correct |
7 | Correct | 5 ms | 552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 552 KB | Output is correct |
2 | Correct | 6 ms | 552 KB | Output is correct |
3 | Correct | 6 ms | 552 KB | Output is correct |
4 | Correct | 5 ms | 552 KB | Output is correct |
5 | Correct | 8 ms | 552 KB | Output is correct |
6 | Correct | 7 ms | 552 KB | Output is correct |
7 | Correct | 8 ms | 552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 552 KB | Output is correct |
2 | Correct | 9 ms | 552 KB | Output is correct |
3 | Correct | 5 ms | 580 KB | Output is correct |
4 | Correct | 4 ms | 584 KB | Output is correct |
5 | Correct | 7 ms | 584 KB | Output is correct |
6 | Correct | 6 ms | 584 KB | Output is correct |
7 | Correct | 4 ms | 584 KB | Output is correct |