#include <bits/stdc++.h>
using namespace std;
int n,c[155];
bool f[155];
int ask(int l,int r)
{
cout<<r-l+1<<' ';
for(int i=l;i<=r;i++)
cout<<i<<' ';
cout<<endl;
int rez;
cin>>rez;
return rez;
}
int main()
{
cin>>n;
int nr=0;
for(int i=1;i<=n;i++)
{
int ans=ask(1,i);
if(ans>nr)
{
nr++;
c[i]=nr;
continue;
}
vector<int> poz;
for(int j=1;j<=n;j++)
f[j]=0;
for(int j=i-1;j>=1;j--)
if(f[c[j]]==0)
{
poz.push_back(j);
f[c[j]]=1;
}
int st=0;
int dr=poz.size();
dr--;
int pmax=0;
while(st<=dr)
{
int mij=(st+dr)/2;
ans=ask(poz[mij],i);
if(ans==mij+2)
{
pmax=mij+1;
st=mij+1;
}
else
dr=mij-1;
}
c[i]=poz[pmax];
}
cout<<"0 ";
for(int i=1;i<=n;i++)
cout<<c[i]<<' ';
cout<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
208 KB |
Integer 12 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
208 KB |
Integer 7 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
296 KB |
Integer 2 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
208 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
208 KB |
Integer 3 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |