# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
108108 | 2019-04-27T13:07:20 Z | tjd229 | Carnival (CEOI14_carnival) | C++14 | 27 ms | 412 KB |
#include <stdio.h> int N; int c[151]; int ask(int s,int e,int piv=0) { int len = e - s + 1 + (piv > 0); if (len == 1) return 1; printf("%d ",len); for (int i = s; i <= e; ++i) printf("%d ",i); if (piv) printf("%d ",piv); printf("\n"); fflush(stdout); int diff; scanf("%d",&diff); return diff; } int find(int piv,int s,int e) { if (s == e) return s; int m = (s + e) >> 1; if (ask(s, m, piv) == ask(s, m)) return find(piv,s,m); return find(piv, m + 1, e); } int main() { int i, cnt = 0; for (scanf("%d",&N),i = 1; i < N; ++i) { if (!c[i]) c[i]=++cnt; if (ask(i, N) == ask(i + 1, N)) { int r = find(i,i+1,N); c[r] = c[i]; } } if (!c[i]) c[i] = ++cnt; for (printf("0 "), i = 1; i <= N; ++i) printf("%d ",c[i]); fflush(stdout); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 384 KB | Output is correct |
2 | Correct | 15 ms | 256 KB | Output is correct |
3 | Correct | 9 ms | 384 KB | Output is correct |
4 | Correct | 9 ms | 412 KB | Output is correct |
5 | Correct | 14 ms | 384 KB | Output is correct |
6 | Correct | 10 ms | 284 KB | Output is correct |
7 | Correct | 19 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 256 KB | Output is correct |
2 | Correct | 23 ms | 384 KB | Output is correct |
3 | Correct | 8 ms | 384 KB | Output is correct |
4 | Correct | 8 ms | 256 KB | Output is correct |
5 | Correct | 17 ms | 256 KB | Output is correct |
6 | Correct | 21 ms | 256 KB | Output is correct |
7 | Correct | 16 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 300 KB | Output is correct |
2 | Correct | 20 ms | 384 KB | Output is correct |
3 | Correct | 19 ms | 384 KB | Output is correct |
4 | Correct | 9 ms | 384 KB | Output is correct |
5 | Correct | 22 ms | 256 KB | Output is correct |
6 | Correct | 17 ms | 384 KB | Output is correct |
7 | Correct | 19 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 384 KB | Output is correct |
2 | Correct | 24 ms | 256 KB | Output is correct |
3 | Correct | 13 ms | 256 KB | Output is correct |
4 | Correct | 9 ms | 256 KB | Output is correct |
5 | Correct | 16 ms | 256 KB | Output is correct |
6 | Correct | 12 ms | 256 KB | Output is correct |
7 | Correct | 12 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 384 KB | Output is correct |
2 | Correct | 19 ms | 384 KB | Output is correct |
3 | Correct | 10 ms | 284 KB | Output is correct |
4 | Correct | 11 ms | 256 KB | Output is correct |
5 | Correct | 11 ms | 252 KB | Output is correct |
6 | Correct | 12 ms | 256 KB | Output is correct |
7 | Correct | 7 ms | 384 KB | Output is correct |