# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532544 | 2022-03-03T06:35:50 Z | christinelynn | Carnival (CEOI14_carnival) | C++17 | 17 ms | 296 KB |
#include <bits/stdc++.h> #define pb push_back using namespace std; int N; int arr[200]; bool cek[200]; void query(int s,int e,int x){ vector<int> temp; for(int i=s; i<=e; i++) temp.pb(i); temp.pb(x); printf("%d ",temp.size()); for(auto &i : temp) printf("%d ",i); puts(""); fflush(stdout); } int get(int s,int e){ int cnt = 0; for(int i=s; i<=e; i++){ if(!cek[arr[i]]) cnt++; cek[arr[i]] = true; } for(int i=s; i<=e; i++){ cek[arr[i]] = false; } return cnt; } void bagi(int s,int e,int x){ if(s == e){ arr[x] = arr[s]; return; } int mid = (s+e)/2; query(s,mid,x); int temp; scanf("%d",&temp); if(temp == get(s,mid)) bagi(s,mid,x); else bagi(mid+1,e,x); } int main(){ scanf("%d",&N); int color = 1; arr[1] = 1; for(int i=2; i<=N; i++){ int temp; query(1,i-1,i); scanf("%d",&temp); if(temp == get(1,i-1)+1){ arr[i] = ++color; continue; } bagi(1,i-1,i); } printf("0 "); for(int i=1; i<=N; i++) printf("%d ",arr[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 200 KB | Output is correct |
2 | Correct | 9 ms | 200 KB | Output is correct |
3 | Correct | 5 ms | 200 KB | Output is correct |
4 | Correct | 3 ms | 200 KB | Output is correct |
5 | Correct | 12 ms | 200 KB | Output is correct |
6 | Correct | 10 ms | 200 KB | Output is correct |
7 | Correct | 10 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 200 KB | Output is correct |
2 | Correct | 11 ms | 272 KB | Output is correct |
3 | Correct | 4 ms | 276 KB | Output is correct |
4 | Correct | 3 ms | 200 KB | Output is correct |
5 | Correct | 12 ms | 292 KB | Output is correct |
6 | Correct | 10 ms | 200 KB | Output is correct |
7 | Correct | 10 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 200 KB | Output is correct |
2 | Correct | 6 ms | 288 KB | Output is correct |
3 | Correct | 7 ms | 288 KB | Output is correct |
4 | Correct | 4 ms | 200 KB | Output is correct |
5 | Correct | 10 ms | 288 KB | Output is correct |
6 | Correct | 5 ms | 296 KB | Output is correct |
7 | Correct | 11 ms | 200 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 200 KB | Output is correct |
2 | Correct | 17 ms | 200 KB | Output is correct |
3 | Correct | 6 ms | 288 KB | Output is correct |
4 | Correct | 3 ms | 288 KB | Output is correct |
5 | Correct | 11 ms | 200 KB | Output is correct |
6 | Correct | 8 ms | 200 KB | Output is correct |
7 | Correct | 10 ms | 200 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 200 KB | Output is correct |
2 | Correct | 13 ms | 268 KB | Output is correct |
3 | Correct | 7 ms | 292 KB | Output is correct |
4 | Correct | 6 ms | 200 KB | Output is correct |
5 | Correct | 6 ms | 292 KB | Output is correct |
6 | Correct | 6 ms | 288 KB | Output is correct |
7 | Correct | 3 ms | 200 KB | Output is correct |