#include<bits/stdc++.h>
using namespace std;
#define INIT ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
int n;
int c[151];
vector<int> v;
void search(){
int l=1, r=((int)v.size())+1, m=(l+r)>>1ll;
while(l<r){
m=(l+r)>>1ll;
cout<<(m)<<" ";
for(int i=v.size()-1; i>=(((int)v.size())-m); i--){
cout<<v[i]<<" ";
}
cout<<"\n"<<flush;
int ans;
cin>>ans;
if( ans==(m) ){
l=(m+1);
}
else{
r=m;
}
m=(l+r)>>1ll;
}
if(m==(((int)v.size())+1) ){
return;
}
else{
c[v.back() ]=c[ v[((int)v.size())-m] ];
v.pop_back();
return;
}
}
void communicate(){
for(int i=1; i<=n; i++){
c[i]=i;
}
for(int i=1; i<=n; i++){
v.pb(i);
search();
}
return;
}
map<int, int> ord;
void order(){
set<int> s;
for(int i=1; i<=n; i++){
s.insert(c[i]);
}
int cnt=1;
for(auto it=s.begin(); it!=s.end(); it++){
ord[*it ]=cnt;
cnt++;
}
for(int i=1; i<=n; i++){
c[i]=ord[c[i] ];
}
}
int32_t main(){
INIT
cin>>n;
communicate();
order();
cout<<"0 ";
for(int i=1; i<=n; i++){
cout<<c[i]<<" ";
}
cout<<flush;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
364 KB |
Output is correct |
2 |
Correct |
6 ms |
512 KB |
Output is correct |
3 |
Correct |
9 ms |
364 KB |
Output is correct |
4 |
Correct |
10 ms |
364 KB |
Output is correct |
5 |
Correct |
3 ms |
364 KB |
Output is correct |
6 |
Correct |
3 ms |
364 KB |
Output is correct |
7 |
Correct |
6 ms |
492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
364 KB |
Output is correct |
2 |
Correct |
8 ms |
364 KB |
Output is correct |
3 |
Correct |
5 ms |
392 KB |
Output is correct |
4 |
Correct |
11 ms |
364 KB |
Output is correct |
5 |
Correct |
7 ms |
364 KB |
Output is correct |
6 |
Correct |
7 ms |
364 KB |
Output is correct |
7 |
Correct |
6 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Output is correct |
2 |
Correct |
4 ms |
364 KB |
Output is correct |
3 |
Correct |
5 ms |
392 KB |
Output is correct |
4 |
Correct |
14 ms |
364 KB |
Output is correct |
5 |
Correct |
7 ms |
364 KB |
Output is correct |
6 |
Correct |
9 ms |
492 KB |
Output is correct |
7 |
Correct |
8 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
364 KB |
Output is correct |
3 |
Correct |
12 ms |
364 KB |
Output is correct |
4 |
Correct |
15 ms |
396 KB |
Output is correct |
5 |
Correct |
7 ms |
364 KB |
Output is correct |
6 |
Correct |
9 ms |
364 KB |
Output is correct |
7 |
Correct |
10 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
364 KB |
Output is correct |
2 |
Correct |
7 ms |
364 KB |
Output is correct |
3 |
Correct |
12 ms |
364 KB |
Output is correct |
4 |
Correct |
10 ms |
364 KB |
Output is correct |
5 |
Correct |
9 ms |
364 KB |
Output is correct |
6 |
Correct |
10 ms |
364 KB |
Output is correct |
7 |
Correct |
10 ms |
392 KB |
Output is correct |