//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma,sse,sse2")
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//#undef LOCALKL
#define IO \
ios_base::sync_with_stdio(0);(cin).tie(0);(cout).tie(0)
#define y1 y1_
#define prev prev_
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#ifdef LOCALKL
// #define cerr cerr<<"\33[1;32m"
// #define cout cout<<"\33[0m"
#else
#ifndef OO
#define endl '\n'
#define cerr if(1){}else cerr
#endif
#endif
#define OK cout<<"OK\n"<<endl;
#define setpre(k) fixed<<setprecision(k)
#define mmset(k,y) memset(k,y,sizeof(k))
#define sz(x) ((int)(x).size())
using pii = pair<int,int>;
using pll = pair<long long,long long>;
using ull = unsigned long long;
using intt = long long;
using ll = long long;
using ld = long double;
const ll m9 = 998244353;
const ll m7 = 1000000007;
const ll m18 = 1000000000000000000;
const ll i127 = 2139062143;
const ll l127 = 9187201950435737471;
int n, c, a[155], x;
vector<int>p;
int main()
{
IO;
p.emplace_back(0);
cin>>n;
cout<<n; for(int i=1;i<=n;i++) cout<<' '<<i; cout<<endl<<flush;
cin>>c;
a[1] = 1;
p.emplace_back(1);
for(int i=2;i<=n;i++)
{
cout<<p.size(); for(int j=1;j<p.size();j++) cout<<' '<<p[j]; cout<<' '<<i; cout<<endl<<flush;
cin>>x;
if(x==p.size())
{
//cerr<<"Added "<<i<<" as "<<p.size()<<endl;
a[i] = p.size();
p.emplace_back(i);
continue;
}
int l=1, r=p.size(), mid;
while(l<r)
{
mid = (l+r)>>1;
cout<<mid; for(int j=1;j<mid;j++) cout<<' '<<p[j]; cout<<' '<<i; cout<<endl<<flush;
cin>>x;
if(x==mid) l=mid+1;
else r=mid;
//cerr<<"> "<<l<<' '<<r<<' '<<mid<<endl;
}
a[i]=l-1;
}
for(int i=0;i<=n;i++) cout<<a[i]<<' ';
return 0;
}
// 1 2 2
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:56:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | cout<<p.size(); for(int j=1;j<p.size();j++) cout<<' '<<p[j]; cout<<' '<<i; cout<<endl<<flush;
| ~^~~~~~~~~
carnival.cpp:58:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | if(x==p.size())
| ~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
200 KB |
Output is correct |
2 |
Correct |
10 ms |
200 KB |
Output is correct |
3 |
Correct |
5 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
200 KB |
Output is correct |
5 |
Correct |
5 ms |
200 KB |
Output is correct |
6 |
Correct |
5 ms |
200 KB |
Output is correct |
7 |
Correct |
11 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Output is correct |
2 |
Correct |
7 ms |
200 KB |
Output is correct |
3 |
Correct |
3 ms |
200 KB |
Output is correct |
4 |
Correct |
5 ms |
200 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
8 ms |
200 KB |
Output is correct |
7 |
Correct |
8 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
200 KB |
Output is correct |
2 |
Correct |
7 ms |
200 KB |
Output is correct |
3 |
Correct |
9 ms |
200 KB |
Output is correct |
4 |
Correct |
3 ms |
316 KB |
Output is correct |
5 |
Correct |
6 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
11 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
200 KB |
Output is correct |
2 |
Correct |
8 ms |
244 KB |
Output is correct |
3 |
Correct |
6 ms |
200 KB |
Output is correct |
4 |
Correct |
4 ms |
312 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
6 ms |
200 KB |
Output is correct |
7 |
Correct |
9 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
200 KB |
Output is correct |
2 |
Correct |
9 ms |
200 KB |
Output is correct |
3 |
Correct |
8 ms |
200 KB |
Output is correct |
4 |
Correct |
7 ms |
200 KB |
Output is correct |
5 |
Correct |
7 ms |
200 KB |
Output is correct |
6 |
Correct |
4 ms |
200 KB |
Output is correct |
7 |
Correct |
4 ms |
316 KB |
Output is correct |