#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=155;
const int mod=1e9+7;
int n,c=1,a[N];
vector <int> v;
void sol(){
cin>>n;
a[n]=c;
v.push_back(n);
auto ask = [&](vector <int> &arya) -> int{
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);
if(ask(cecilia)==(int)cecilia.size()-1){
pos=*max_element(cecilia.begin(),cecilia.end());
r=mid-1;
}else l=mid+1;
}
if(pos==-1) a[i]=++c,v.push_back(i);
else a[i]=a[pos];
};
for(int i=n-1; i>=1; i--) find(i);
cout<<"0 ";
for(int i=1; i<=n; i++) 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:69:9: warning: "/*" within comment [-Wcomment]
69 | /** /\_/\
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
708 KB |
Output is correct |
3 |
Correct |
6 ms |
344 KB |
Output is correct |
4 |
Correct |
9 ms |
592 KB |
Output is correct |
5 |
Correct |
2 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
452 KB |
Output is correct |
7 |
Correct |
4 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
7 ms |
456 KB |
Output is correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
6 |
Correct |
4 ms |
344 KB |
Output is correct |
7 |
Correct |
5 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
344 KB |
Output is correct |
4 |
Correct |
9 ms |
464 KB |
Output is correct |
5 |
Correct |
6 ms |
456 KB |
Output is correct |
6 |
Correct |
5 ms |
460 KB |
Output is correct |
7 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
6 ms |
460 KB |
Output is correct |
4 |
Correct |
7 ms |
344 KB |
Output is correct |
5 |
Correct |
5 ms |
464 KB |
Output is correct |
6 |
Correct |
6 ms |
456 KB |
Output is correct |
7 |
Correct |
5 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
4 ms |
344 KB |
Output is correct |
3 |
Correct |
6 ms |
344 KB |
Output is correct |
4 |
Correct |
6 ms |
460 KB |
Output is correct |
5 |
Correct |
8 ms |
344 KB |
Output is correct |
6 |
Correct |
7 ms |
344 KB |
Output is correct |
7 |
Correct |
7 ms |
464 KB |
Output is correct |