#include <bits/stdc++.h>
using namespace std;
int ask(int l,int r){
cout<<r-l+1<<" ";
for(int i=l;i<=r;i++)cout<<i<<" ";
cout<<endl;
int p;cin>>p;
return p;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int x;cin>>x;
map<int,int>mp;
vector<int>ans,lol;
int lst=0;
for(int i=1;i<=x;i++){
int z=ask(1,i);
if(z>lst){
lst=z;
ans.push_back(z);
}else{
int l=1,r=lst,mid,m=0;
vector<int>aa;
for(auto i:mp)aa.push_back(i.second);
sort(aa.begin(),aa.end());
while(l<=r){
mid=(l+r)/2;
int xd=ask(aa[mid-1],i);
if(xd<lst)r=mid-1;
else l=mid+1,m=mid;
}
ans.push_back(m);
}
mp[ans.back()]=i;
}
cout<<"0 ";
for(auto i:ans)cout<<i<<" ";
cout<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
208 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
312 KB |
Integer 0 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
324 KB |
Output is correct |
2 |
Incorrect |
7 ms |
208 KB |
Integer 0 violates the range [1, 8] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
208 KB |
Integer 0 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
208 KB |
Integer 0 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |