# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1105445 | 2024-10-26T12:16:43 Z | lkateris | Carnival (CEOI14_carnival) | C++17 | 7 ms | 508 KB |
#include <iostream> #include <vector> using namespace std; vector<int> l; int printq(int a,int b,int n) { printf("%d",b-a+2); for(int i = a;i<=b;++i) { printf(" %d",l[i]); } printf(" %d\n",n); fflush(stdout); int res = 0; scanf("%d",&res); return res; } int main() { int N; scanf("%d",&N); int cost[N+1]; cost[1] = 1; int cnt = 1; l.push_back(1); for(int i=2;i<=N;++i) { int q = printq(0,cnt-1,i); if (q > cnt) { l.push_back(i); cnt++; cost[i] = cnt; } else { int l=0; int r=cnt-1; int m=(l+r)/2; while (l < r) { q = printq(l,m,i); if (q > m-l+1) l = m+1; else r = m; m=(l+r)/2; } cost[i] = cost[r+1]; } } printf("0"); for(int i=1;i<=N;++i) { printf(" %d",cost[i]); } printf("\n"); fflush(stdout); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 336 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 336 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 336 KB | Output is correct |
2 | Incorrect | 4 ms | 336 KB | Incorrect |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 336 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 336 KB | Output is correct |
2 | Incorrect | 7 ms | 508 KB | Incorrect |
3 | Halted | 0 ms | 0 KB | - |