# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
938871 | sleepntsheep | Carnival (CEOI14_carnival) | C11 | 13 ms | 344 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.
/*
CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k
CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k
CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k
CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k
CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k
CARNIVAL -> https://www.youtube.com/watch?v=Fc7-Oe0tj5k
*/
#include <stdio.h>
int n, a[150], m;
int ask(int l,int r,int i)
{
printf("%d ",r-l+1+(!!~i));
for (int i = l; i <= r; ++i) printf("%d ", i+1);
if(~i) printf("%d", i+1);
puts("");
fflush(stdout);
int x;
scanf("%d", &x);
return x;
}
int main()
{
scanf("%d", &n);
a[0] = ++m;
for (int i = 1; i < n; ++i)
{
if (ask(0, i-1, -1) != ask(0, i-1, i))
{
a[i]=++m;
continue;
}
int l = 0, r = i - 1;
while (l < r)
{
int o = (l+r)/2;
if (ask(l, o, -1) == ask(l, o, i))
{
r = o;
continue;
}
else
{
l = o + 1;
}
}
a[i] = a[l];
}
printf("0");
for (int i = 0; i < n; ++i) printf(" %d", i);fflush(stdout);
}
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... |