# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
600101 | MasterTaster | Carnival (CEOI14_carnival) | C++14 | 18 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.
#include <iostream>
#include <vector>
#define pb push_back
#define MAXN 155
using namespace std;
int n, prosli[MAXN], ress[MAXN];
vector<int> novi;
bool check(int k, int i)
{
cout<<k+1<<" ";
for (int j=0; j<=k; j++) cout<<novi[j]<<" ";
cout<<endl;
int cnt1; cin>>cnt1;
cout<<k+2<<" ";
for (int j=0; j<=k; j++) cout<<novi[j]<<" ";
cout<<i<<endl;
int cnt2; cin>>cnt2;
return (cnt1==cnt2);
}
int main() {
cin>>n;
int cnt=1;
novi.pb(1);
for (int i=2; i<=n; i++)
{
vector<int> sta;
for (int j=1; j<=i; j++) sta.pb(j);
cout<<sta.size()<<" ";
for (int i=0; i<sta.size(); i++) cout<<sta[i]<<" ";
cout<<endl;
int tren; cin>>tren;
if (tren>cnt)
{
prosli[i]=0;
cnt=tren;
novi.pb(i);
}
else
{
int l=0, r=novi.size()-1, gde=-1;
while (l<=r)
{
int mid=l+(r-l)/2;
if (check(mid, i))
{
r=mid-1;
gde=mid;
}
else
l=mid+1;
}
prosli[i]=novi[gde];
}
}
int col=1;
for (int i=1; i<=n; i++)
{
if (prosli[i]==0) { ress[i]=col++; }
else ress[i]=ress[prosli[i]];
}
cout<<0<<" ";
for (int i=1; i<=n; i++) cout<<ress[i]<<" ";
cout<<endl;
}
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... |