# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
155006 | 2019-09-25T21:04:49 Z | TadijaSebez | Carnival (CEOI14_carnival) | C++11 | 15 ms | 396 KB |
#include <bits/stdc++.h> using namespace std; #define pb push_back int Ask(vector<int> v, int n) { printf("%i ",n); for(int i=0;i<n;i++) printf("%i ",v[i]); printf("\n"); fflush(stdout); int b;scanf("%i",&b); return b; } int Ask(vector<int> v, int n, int x) { printf("%i ",n+1); for(int i=0;i<n;i++) printf("%i ",v[i]); printf("%i\n",x); fflush(stdout); int b;scanf("%i",&b); return b; } const int N=155; int col[N]; int main() { int n; scanf("%i",&n); vector<int> all,fir,work; for(int i=1;i<=n;i++) all.pb(i); int pre=0; for(int i=1;i<=n;i++) { int now=Ask(all,i); if(now!=pre) fir.pb(i),col[i]=fir.size(); else work.pb(i); pre=now; } for(int x:work) { int top=fir.size(),bot=1,mid,ans=fir.size(); while(top>=bot) { mid=top+bot>>1; if(Ask(fir,mid,x)==mid) top=mid-1,ans=mid; else bot=mid+1; } col[x]=ans; } printf("0 "); for(int i=1;i<=n;i++) printf("%i ",col[i]); printf("\n"); fflush(stdout); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 296 KB | Output is correct |
2 | Correct | 13 ms | 376 KB | Output is correct |
3 | Correct | 10 ms | 248 KB | Output is correct |
4 | Correct | 4 ms | 248 KB | Output is correct |
5 | Correct | 7 ms | 248 KB | Output is correct |
6 | Correct | 7 ms | 376 KB | Output is correct |
7 | Correct | 11 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 248 KB | Output is correct |
2 | Correct | 12 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 396 KB | Output is correct |
4 | Correct | 7 ms | 392 KB | Output is correct |
5 | Correct | 10 ms | 376 KB | Output is correct |
6 | Correct | 8 ms | 244 KB | Output is correct |
7 | Correct | 15 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 248 KB | Output is correct |
2 | Correct | 10 ms | 248 KB | Output is correct |
3 | Correct | 12 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 7 ms | 376 KB | Output is correct |
6 | Correct | 10 ms | 376 KB | Output is correct |
7 | Correct | 13 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 376 KB | Output is correct |
2 | Correct | 9 ms | 248 KB | Output is correct |
3 | Correct | 7 ms | 376 KB | Output is correct |
4 | Correct | 4 ms | 248 KB | Output is correct |
5 | Correct | 12 ms | 248 KB | Output is correct |
6 | Correct | 6 ms | 376 KB | Output is correct |
7 | Correct | 11 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 248 KB | Output is correct |
2 | Correct | 13 ms | 376 KB | Output is correct |
3 | Correct | 11 ms | 376 KB | Output is correct |
4 | Correct | 10 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 248 KB | Output is correct |
6 | Correct | 9 ms | 296 KB | Output is correct |
7 | Correct | 6 ms | 248 KB | Output is correct |