# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164473 | mhy908 | Carnival (CEOI14_carnival) | C++14 | 26 ms | 380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
int query(int a, int b){
printf("%d ", b-a+1);
for(int i=a; i<=b; i++)printf("%d ", i);
fflush(stdout);
int ret;
scanf("%d", &ret);
return ret;
}
int n, col[160], r, sum[160];
int main()
{
scanf("%d", &n);
col[1]=sum[1]=++r;
for(int i=2; i<=n; i++){
sum[i]=query(1, i);
if(sum[i-1]+1==sum[i]){
col[i]=++r;
continue;
}
else{
int s=1, e=i-1;
while(s<e){
int mid=(s+e)/2+1;
if(query(mid, i)==query(mid, i-1)+1)e=mid-1;
else s=mid;
}
col[i]=col[s];
}
}
for(int i=0; i<=n; i++)printf("%d ", col[i]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |