# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116651 | 2019-06-13T10:29:54 Z | roseanne_pcy | Carnival (CEOI14_carnival) | C++14 | 10 ms | 432 KB |
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 155; vector<int> cand[maxn]; int col[maxn]; int ask(vector<int> vec) { printf("%d ", vec.size()); for(int x : vec) printf("%d ", x); printf("\n"); fflush(stdout); int res; scanf("%d", &res); return res; } int solve(vector<int> poss, int x) { if(poss.size() == 1) { return col[poss[0]]; } int lo = 0, hi = (int) poss.size()-1; int mid = (lo+hi)/2; vector<int> a1, a2; for(int i = 0; i<= hi; i++) { if(i<= mid) a1.pb(poss[i]); else a2.pb(poss[i]); } vector<int> send = a1; send.pb(x); int res = ask(send); if(res == send.size()) return solve(a2, x); return solve(a1, x); } int main() { int n; scanf("%d", &n); col[1] = 1; cand[1].pb(1); int lim = 1; for(int i = 2; i<= n; i++) { vector<int> send; for(int j = 1; j<= lim; j++) send.pb(cand[j].back()); send.pb(i); int res = ask(send); if(res == lim+1) { col[i] = lim+1; cand[lim+1].pb(i); lim++; continue; } send.pop_back(); col[i] = solve(send, i); cand[col[i]].pb(i); } printf("0 "); for(int i = 1; i<= n; i++) printf("%d ", col[i]); printf("\n"); fflush(stdout); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 256 KB | Output is correct |
2 | Correct | 7 ms | 384 KB | Output is correct |
3 | Correct | 7 ms | 256 KB | Output is correct |
4 | Correct | 3 ms | 432 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 8 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 408 KB | Output is correct |
3 | Correct | 6 ms | 416 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 408 KB | Output is correct |
6 | Correct | 6 ms | 256 KB | Output is correct |
7 | Correct | 7 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 332 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 10 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 7 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 8 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 256 KB | Output is correct |
2 | Correct | 9 ms | 256 KB | Output is correct |
3 | Correct | 7 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 8 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 7 ms | 384 KB | Output is correct |
3 | Correct | 9 ms | 256 KB | Output is correct |
4 | Correct | 6 ms | 332 KB | Output is correct |
5 | Correct | 9 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 328 KB | Output is correct |