# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25915 | imsifile | Carnival (CEOI14_carnival) | C++98 | 13 ms | 1116 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<stdio.h>
int N, ba[222], numix[222];
int getrange(int s, int e){
printf("%d ", e-s+1);
for(int i=s; i<=e; i++) printf("%d ", i);
fflush(stdout);
int res; scanf("%d", &res);
return res;
}
int getin(int ix, int s, int e){
printf("%d %d ", e-s+2, ix);
for(int i=s; i<=e; i++) printf("%d ", numix[i]);
fflush(stdout);
int res; scanf("%d", &res);
return res;
}
int main(){
scanf("%d", &N);
int pv=0;
for(int i=1; i<=N; i++){
int cn = getrange(1,i);
if(pv<cn) ba[i]=cn, numix[cn]=i;
pv=cn;
}
for(int i=1; i<=N; i++){
if(ba[i])continue;
int mi=1, mx=pv, md;
while(1){
md=(mi+mx)/2;
if(mi>=mx) break;
int cn = getin(i, mi, md);
if(cn == md-mi+1) mx=md;
else mi=md+1;
}
ba[i]=md;
}
printf("0 ");
for(int i=1; i<=N; i++) printf("%d ", ba[i]);
fflush(stdout);
return 0;
}
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... |