# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27648 | samir_droubi | Carnival (CEOI14_carnival) | C++14 | 29 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;
const int mxn=155;
int ty[mxn];
int n;
int sz=0;
int query(int l,int r)
{
int nm=0;
for(int i=l;i<=r;++i)
{
if(ty[i]==0)
++nm;
}
printf("%d",nm);
for(int i=l;i<=r;++i)
{
if(ty[i]==0)
printf(" %d",i);
}
printf("\n");
fflush(stdout);
int ans;
scanf("%d",&ans);
return ans;
}
int bs(int num)
{
int l=1;
int r=n;
int in=-1;
while(l<=r)
{
int md=(l+r)/2;
int x=query(1,md);
if(x>num)
r=md-1;
else
{
l=md+1;
in=md;
}
}
return in;
}
int main()
{
scanf("%d",&n);
sz=query(1,n)-1;
int cur=1;
while(sz)
{
while(true)
{
int in=bs(sz);
if(in==n)break;
ty[in+1]=cur;
}
++cur;
--sz;
}
for(int i=1;i<=n;++i)
{
if(ty[i]==0)
ty[i]=cur;
}
printf("0");
for(int i=1;i<=n;++i)
printf(" %d",ty[i]);
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... |