#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define int long long
#define repp(i,x,n) for(int i=x;i<=n;i++)
#define rep(i,x,n) for(int i=x;i>=n;i--)
#define cy cout<<"YES"<<endl
#define cn cout<<"NO"<<endl
#define ca cout<<"Alice"<<endl
#define r0 return 0
#define fi first
#define se second
#define liow ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define jelek cout<<"jelek"<<endl
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define pi pair<pair<int,int>,pair<int,int>>
#define p3 pair<int,pair<int,int>>
#define p2
#define tp tuple<int,int,int>
#define fl fflush(stdout)
#define lb long double
#define p5 pair<int,pair<pair<int,int>,pair<int,int>>>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef long long bryson;
const int mod=1e9+7;
const int SQMAX=635,INF=1e18;
//const int mod=998244353;
//const int MOD=1e6+3;
mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
pii dr[8]={{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int dxx[4]={1,1,-1,-1};
int dyy[4]={1,-1,-1,1};
int mul(int x,int y){return (x%mod*y%mod)%mod;}
int expo(int b,int e){
if(e==0) return 1;
int tmp=expo(b,e/2);
if(e%2) return mul(tmp,mul(tmp,b));
else return mul(tmp,tmp);
}
const int maxn=3e5+5;
const int N=1e6;
void solve(){
int n;cin>>n;
int ans[n+2];
ans[1]=1;
int nw=1;
vector<int>dmn(n+2,-1);
int brp=1;
int ang=1;
while(nw<=n){
int l=nw,r=n;
int an=-1;
while(l<=r){
int mid=(l+r)/2;
cout<<mid-l+1<<" ";
repp(i,nw,mid) cout<<i<<" ";
cout<<endl;
int x;cin>>x;
if(x==1){
l=mid+1;
an=mid;
} else {
r=mid-1;
}
}
// cout<<nw<<" "<<an<<"ahh "<<endl;
dmn[ang]=an;
repp(i,nw,an) ans[i]=ang;
nw=an+1;
if(nw>n) break;
if(brp==1){
brp++;
ang++;
continue;
}
l=1,r=brp;
int aa=-1;
while(l<=r){
int mid=(l+r)/2;
cout<<brp-mid+2<<" ";
repp(i,mid,brp){
cout<<dmn[i]<<" ";
}
cout<<nw<<endl;
int x;cin>>x;
if(brp-mid+1>=x){
aa=mid;
l=mid+1;
} else {
r=mid-1;
}
}
if(aa==-1){
brp++;
ang=brp;
} else {
ang=aa;
}
}
cout<<0<<" ";
repp(i,1,n) cout<<ans[i]<<" ";
cout<<endl;
}
signed main(){
liow;
int tc=1;
// cin>>tc;
while(tc--){
solve();
}
}
# | 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... |