// #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <set>
#include <deque>
using namespace std;
#define int long long
// #define endl "\n"
#define fi first
#define se second
const int M=1203465797;
const int inf = 1e14;
const int LOG=18;
const int N=2e3+5;
int n , m , c , w , k , t=1 , q=1 , x , y , z , l , r;
void solve(){
cin >> n;
int j=1;
vector<int>a;
for (int i=1;i<=n;i++){
a.push_back(i);
}
vector<int>d(n+1);
while (a.size()){
int l=1;
int h=a.size();
int m=(l+h)/2;
cout << h << " ";
for (int i=0;i<h;i++){
cout << a[i] << " ";
}
cout << endl;
cin >> x;
if (x==h)break;
while (l<h){
cout << m << " ";
for (int i=0;i<m;i++){
cout << a[i] << " ";
}
cout << endl;
cin >> x;
if (x==m){
l=m+1;
}
else{
h=m;
}
m=(l+h)/2;
}
int mi=m;
l=0;
h=m;
m=(l+h+1)/2;
while (l<h){
if (mi-m){
cout << mi-m << " ";
for (int i=m;i<mi;i++){
cout << a[i] << " ";
}
cout << endl;
cin >> x;
}
else{
x=0;
}
if (x==mi-m){
h=m-1;
}
else{
l=m;
}
m=(l+h+1)/2;
}
if (!d[a[m]]){
d[a[m]]=j++;
}
d[a[mi-1]]=d[a[m]];
a.erase(a.begin()+mi-1);
}
cout << 0 << " ";
for (int i=1;i<=n;i++){
if (!d[i])d[i]=j++;
cout << d[i] << " ";
}
cout << endl;
}
signed main()
{
// #ifndef ONLINE_JUDGE
// freopen("input.txt","r" ,stdin);
// freopen("output.txt","w",stdout);
// #endif
// ios::sync_with_stdio(0);//DO NOT USE IN INTERACTIVE
// cin.tie(0), cout.tie(0);//DO NOT USE IN INTERACTIVE
cout << fixed << setprecision(9);
srand(time(0));
// int t=1;
// cin >> t;
for (int _=1;_<=t;_++){
solve();
q++;
}
}
| # | 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... |