#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<<" ";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
332 KB |
Output is correct |
2 |
Correct |
8 ms |
332 KB |
Output is correct |
3 |
Correct |
5 ms |
328 KB |
Output is correct |
4 |
Correct |
3 ms |
328 KB |
Output is correct |
5 |
Correct |
4 ms |
332 KB |
Output is correct |
6 |
Correct |
4 ms |
328 KB |
Output is correct |
7 |
Correct |
5 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
332 KB |
Output is correct |
3 |
Correct |
3 ms |
324 KB |
Output is correct |
4 |
Correct |
5 ms |
328 KB |
Output is correct |
5 |
Correct |
6 ms |
328 KB |
Output is correct |
6 |
Correct |
3 ms |
332 KB |
Output is correct |
7 |
Correct |
7 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
328 KB |
Output is correct |
2 |
Correct |
5 ms |
328 KB |
Output is correct |
3 |
Correct |
7 ms |
328 KB |
Output is correct |
4 |
Correct |
3 ms |
328 KB |
Output is correct |
5 |
Correct |
5 ms |
328 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
8 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
328 KB |
Output is correct |
3 |
Correct |
5 ms |
328 KB |
Output is correct |
4 |
Correct |
3 ms |
328 KB |
Output is correct |
5 |
Correct |
8 ms |
328 KB |
Output is correct |
6 |
Correct |
3 ms |
324 KB |
Output is correct |
7 |
Correct |
8 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
328 KB |
Output is correct |
2 |
Correct |
7 ms |
328 KB |
Output is correct |
3 |
Correct |
6 ms |
332 KB |
Output is correct |
4 |
Correct |
6 ms |
328 KB |
Output is correct |
5 |
Correct |
7 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
336 KB |
Output is correct |