| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 545140 | rainboy | Carnival (CEOI14_carnival) | C11 | 9 ms | 276 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>
#include <string.h>
#define N 150
int query(int *ii, int k) {
int h, x;
printf("%d", k);
for (h = 0; h < k; h++)
printf(" %d", ii[h] + 1);
printf("\n"), fflush(stdout);
scanf("%d", &x);
return x;
}
int main() {
static int ii[N], ii_[N], hh[N];
int n, n_, i;
scanf("%d", &n);
n_ = 0;
for (i = 0; i < n; i++) {
ii[n_] = i;
if (query(ii, n_ + 1) == n_ + 1)
hh[i] = n_++;
else {
int lower = 0, upper = n_;
while (upper - lower > 1) {
int h = (lower + upper) / 2;
memcpy(ii_, ii + lower, (h - lower) * sizeof *ii);
ii_[h - lower] = i;
if (query(ii_, h - lower + 1) == h - lower + 1)
lower = h;
else
upper = h;
}
hh[i] = lower;
}
}
printf("0");
for (i = 0; i < n; i++)
printf(" %d", hh[i] + 1);
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... | ||||
