#include "bits/stdc++.h"
using namespace std;
#ifdef N_N_C
#include "debug.h"
#else
#define cebug(...) "Arya"
#endif
#define int long long
const int N=105;
const int mod=1e9+7;
int n,c=1,a[N],query;
vector <int> v;
void sol(){
cin>>n;
a[n]=c;
v.push_back(n);
auto ask = [&](vector <int> &arya) -> int{
query++;
assert(!arya.empty());
cout<<(int)arya.size()<<" ";
for(auto x:arya) cout<<x<<" ";
cout<<endl;
int q;
cin>>q;
return q;
};
auto find = [&](int i) -> void{
int l=i+1,r=n,pos=-1;
while(l<=r){
int mid=(l+r)>>1;
vector <int> cecilia;
for(auto x:v){
if(x>mid) continue;
cecilia.push_back(x);
}
if(cecilia.empty()){
l=mid+1;
continue;
}
cecilia.push_back(i);
int val=ask(cecilia);
if(val==(int)cecilia.size()-1){
pos=*max_element(cecilia.begin(),cecilia.end());
r=mid-1;
}else l=mid+1;
//cerr<<"cb : "<<i<<" "<<pos<<endl;
}
if(pos==-1) a[i]=++c,v.push_back(i);
else a[i]=a[pos];
};
int v=2;
for(int i=n-1; i>=1; i--){
find(i);
assert(a[i]<=n);
}
cout<<"0 ";
for(int i=1; i<=n; i++){
//assert(a[i]>=1 and a[i]<=n);
cout<<a[i]<<" ";
}
cout<<endl;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen(".inp", "r", stdin);
// freopen(".out", "w", stdout);
int tt=1;
//cin>>tt;
while(tt--){
sol();
}
cerr << "\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
return 0;
}
/** /\_/\
* (= ._.)
* / >💖 \>💕
**/
Compilation message
carnival.cpp:80:9: warning: "/*" within comment [-Wcomment]
80 | /** /\_/\
|
carnival.cpp: In function 'void sol()':
carnival.cpp:55:6: warning: unused variable 'v' [-Wunused-variable]
55 | int v=2;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |