# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130288 | 2019-07-14T16:56:58 Z | PeppaPig | Carnival (CEOI14_carnival) | C++14 | 9 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; const int N = 105; int ask(vector<int> &v, int ret = 0) { printf("%d ", (int)v.size()); for(int i = 0; i < (int)v.size() - 1; i++) printf("%d ", v[i]); printf("%d\n", v.back()), fflush(stdout); scanf("%d", &ret); return ret; } int n, a[N]; int main() { scanf("%d", &n); vector<int> vec = {1}; for(int i = 2; i <= n; i++) { vector<int> tmp = vec; tmp.emplace_back(i); if(ask(tmp) == tmp.size()) vec = tmp; } for(int i = 1; i <= vec.size(); i++) a[vec[i-1]] = i; for(int i = 1; i <= n; i++) if(!a[i]) { int l = 1, r = vec.size(); while(l < r) { int mid = (l + r) >> 1; vector<int> now; for(int j = 0; j < mid; j++) now.emplace_back(vec[j]); now.emplace_back(i); if(ask(now) == mid) r = mid; else l = mid + 1; } a[i] = a[r]; } printf("0 "); for(int i = 1; i <= n; i++) printf("%d ", a[i]); printf("\n"), fflush(stdout); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 248 KB | Integer 137 violates the range [1, 11] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 376 KB | Integer 145 violates the range [1, 5] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 248 KB | Integer 133 violates the range [1, 1] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 376 KB | Integer 143 violates the range [1, 4] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 376 KB | Integer 149 violates the range [1, 2] |
2 | Halted | 0 ms | 0 KB | - |