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;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long ans[1505],cur=0,pa[1505];
set < long long> grp[155];
void calc(long long fr,long long sc,long long me)
{
if(fr==sc)
{
grp[fr].insert(me);
pa[me]=fr;
return;
}//cout<<"HI ";
long long mid=fr+sc;
mid/=2;
cout<<mid-fr+2<<" ";
for(int i=fr;i<=mid;i++)
{
cout<<*grp[i].begin()+1<<" ";
}
cout<<me+1<<endl;
long long ou;
cin>>ou;
if(ou==mid-fr+1)
{
calc(fr,mid,me);
}
else
calc(mid+1,sc,me);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n;
cin>>n;
for(int i=0;i<n;i++)
{
cout<<i+1<<" ";
for(int j=0;j<=i;j++)
{
cout<<j+1<<" ";
}
cout<<endl;
cin>>ans[i];
if(i!=0)
{
if(ans[i]==ans[i-1])
{
calc(0,cur-1,i);
}
else
{
grp[cur].insert(i);
pa[i]=cur;
cur++;
}
}
else
{
grp[cur].insert(i);
pa[i]=cur;
cur++;
}
}
cout<<"0 ";
for(int i=0;i<n;i++)
{
cout<<pa[i]+1<<" ";
}
}
# | 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... |