# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25914 | 2017-06-25T05:58:48 Z | 서규호(#1088) | Carnival (CEOI14_carnival) | C++14 | 16 ms | 2020 KB |
#include <bits/stdc++.h> #define lld long long #define pp pair<int,int> #define pb push_back #define MOD 1000000007 #define left lleft #define right rright #define INF 2000000000 #define Linf 1000000000000000000LL #define next nnext #define minus mminus using namespace std; int N; int a[200]; bool check[200]; void query(int s,int e,int x){ vector<int> tmp; for(int i=s; i<=e; i++) tmp.pb(i); tmp.pb(x); printf("%d ",tmp.size()); for(auto &i : tmp) printf("%d ",i); puts(""); fflush(stdout); } int get(int s,int e){ int cnt = 0; for(int i=s; i<=e; i++){ if(!check[a[i]]) cnt++; check[a[i]] = true; } for(int i=s; i<=e; i++){ check[a[i]] = false; } return cnt; } void divide(int s,int e,int x){ if(s == e){ a[x] = a[s]; return; } int mid = (s+e)/2; query(s,mid,x); int tmp; scanf("%d",&tmp); if(tmp == get(s,mid)) divide(s,mid,x); else divide(mid+1,e,x); } int main(){ scanf("%d",&N); int color = 1; a[1] = 1; for(int i=2; i<=N; i++){ int tmp; query(1,i-1,i); scanf("%d",&tmp); if(tmp == get(1,i-1)+1){ a[i] = ++color; continue; } divide(1,i-1,i); } printf("0 "); for(int i=1; i<=N; i++) printf("%d ",a[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2020 KB | Output is correct |
2 | Correct | 6 ms | 2020 KB | Output is correct |
3 | Correct | 0 ms | 2020 KB | Output is correct |
4 | Correct | 3 ms | 2020 KB | Output is correct |
5 | Correct | 9 ms | 2020 KB | Output is correct |
6 | Correct | 16 ms | 2020 KB | Output is correct |
7 | Correct | 3 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2020 KB | Output is correct |
2 | Correct | 13 ms | 2020 KB | Output is correct |
3 | Correct | 6 ms | 2020 KB | Output is correct |
4 | Correct | 3 ms | 2020 KB | Output is correct |
5 | Correct | 3 ms | 2020 KB | Output is correct |
6 | Correct | 13 ms | 2020 KB | Output is correct |
7 | Correct | 6 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
3 | Correct | 6 ms | 2020 KB | Output is correct |
4 | Correct | 0 ms | 2020 KB | Output is correct |
5 | Correct | 3 ms | 2020 KB | Output is correct |
6 | Correct | 6 ms | 2020 KB | Output is correct |
7 | Correct | 6 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2020 KB | Output is correct |
2 | Correct | 13 ms | 2020 KB | Output is correct |
3 | Correct | 3 ms | 2020 KB | Output is correct |
4 | Correct | 3 ms | 2020 KB | Output is correct |
5 | Correct | 3 ms | 2020 KB | Output is correct |
6 | Correct | 6 ms | 2020 KB | Output is correct |
7 | Correct | 9 ms | 2020 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 2020 KB | Output is correct |
2 | Correct | 9 ms | 2020 KB | Output is correct |
3 | Correct | 6 ms | 2020 KB | Output is correct |
4 | Correct | 3 ms | 2020 KB | Output is correct |
5 | Correct | 9 ms | 2020 KB | Output is correct |
6 | Correct | 0 ms | 2020 KB | Output is correct |
7 | Correct | 0 ms | 2020 KB | Output is correct |