# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29582 | 2017-07-20T07:27:35 Z | rondojim | Carnival (CEOI14_carnival) | C++14 | 9 ms | 1116 KB |
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; const int MAXN = 155; int color[MAXN], inv[MAXN], N, d, s; void ask_range(int l, int r){ printf("%d ", r - l + 1); for(int i=l; i<=r; ++i) printf("%d ", i); printf("\n"); fflush(stdout); scanf("%d", &s); } void ask_color(int idx, int l, int r){ printf("%d %d ", r - l + 2, idx); for(int i=l; i<=r; ++i) printf("%d ", inv[i]); printf("\n"); fflush(stdout); scanf("%d", &s); } int main(){ scanf("%d", &N); color[1] = d = inv[1] = 1; for(int i=2; i<=N; ++i){ ask_range(1, i); if(s == d + 1) inv[color[i] = ++d] = i; } for(int i=1; i<=N; ++i){ if(color[i]) continue; int lo = 1, hi = d, mid, res; while(lo <= hi){ mid = (lo + hi)>>1; ask_color(i, 1, mid); if(s == mid) res = mid, hi = mid - 1; else lo = mid + 1; } color[i] = res; } printf("0 "); for(int i=1; i<=N; ++i) printf("%d ", color[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1116 KB | Output is correct |
2 | Correct | 9 ms | 1116 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 0 ms | 1116 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 3 ms | 1116 KB | Output is correct |
7 | Correct | 3 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 1116 KB | Output is correct |
2 | Correct | 3 ms | 1116 KB | Output is correct |
3 | Correct | 6 ms | 1116 KB | Output is correct |
4 | Correct | 3 ms | 1116 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 6 ms | 1116 KB | Output is correct |
7 | Correct | 3 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 3 ms | 1116 KB | Output is correct |
3 | Correct | 6 ms | 1116 KB | Output is correct |
4 | Correct | 0 ms | 1116 KB | Output is correct |
5 | Correct | 6 ms | 1116 KB | Output is correct |
6 | Correct | 6 ms | 1116 KB | Output is correct |
7 | Correct | 3 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1116 KB | Output is correct |
2 | Correct | 6 ms | 1116 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 3 ms | 1116 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 6 ms | 1116 KB | Output is correct |
7 | Correct | 0 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 6 ms | 1116 KB | Output is correct |
3 | Correct | 9 ms | 1116 KB | Output is correct |
4 | Correct | 9 ms | 1116 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 3 ms | 1116 KB | Output is correct |
7 | Correct | 3 ms | 1116 KB | Output is correct |