# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25969 | tlwpdus | Carnival (CEOI14_carnival) | C++98 | 9 ms | 2020 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>
using namespace std;
int n;
int color[160];
int rep[160];
int key = 0;
void bs(int idx) {
int s = 1, e = key, i;
while(s<e) {
int m = (s+e)>>1;
printf("%d ",m-s+2);
for (i=s;i<=m;i++) printf("%d ",rep[i]);
printf("%d\n",idx);
fflush(stdout);
int a;
scanf("%d",&a);
if (a==m-s+1) e = m;
else s = m+1;
}
color[idx] = s;
}
int main() {
int i, j;
scanf("%d",&n);
for (i=1;i<=n;i++) {
printf("%d ",i);
for (j=1;j<=i;j++) printf("%d ",j);
printf("\n"); fflush(stdout);
int val;
scanf("%d",&val);
if (key<val) {
key=val;
color[i] = key;
rep[key] = i;
}
}
for (i=1;i<=n;i++) {
if (color[i]) continue;
bs(i);
}
printf("0 ");
for (i=1;i<=n;i++) printf("%d ",color[i]);
printf("\n");
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... |