# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085717 | vjudge1 | Carnival (CEOI14_carnival) | C++17 | 82 ms | 592 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;
vector<int>v;
bool check2(int l,int r,int k)
{
cout<<r-l+2<<" ";
for(int i=l;i<=r;i++)
{
cout<<v[i]<<" ";
}
cout<<k<<endl;
int a;
cin>>a;
if(a==r-l+2)
{
return true;
}
return false;
}
bool check(int k)
{
cout<<v.size()+1<<" ";
for(int i=0;i<v.size();i++)
{
cout<<v[i]<<" ";
}
cout<<k<<endl;
int a;
cin>>a;
if(a==v.size()+1)
{
return true;
}
return false;
}
int main()
{
int n,cnt=1;
cin>>n;
vector<int>res(n+1);
res[1]=cnt++;
v.push_back(1);
for(int i=2;i<=n;i++)
{
if(check(i))
{
v.push_back(i);
res[i]=cnt++;
}
else
{
int l=0,r=v.size()-1;
while(l<r)
{
int m=l+r/2;
if(check2(l,m,i))
{
l=m+1;
}
else
{
r=m;
}
}
res[i]=res[v[l]];
}
}
cout<<"0 ";
for(int i=1;i<=n;i++)
{
cout<<res[i]<<" ";
}
cout<<endl;
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... |