//#pragma GCC optimize ("O2")
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define ld long double
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
const ll maxn = 200;
vector<ll> T[200];
vector<ll> pos;
ll A[maxn];
bool ask(ll l, ll r, ll k)
{
vector<ll> save;
for(int i = l; i<= r; i++) save.push_back(pos[i]);
save.push_back(k);
cout << save.size() << " ";
for(auto u: save) cout << u << " ";
cout << endl;
ll vl; cin >> vl;
if(vl==save.size()) return 0;
else return 1;
}
ll n;
void fi(ll l, ll r, ll num)
{
if(l==r)
{
A[num] = l;
return;
}
else
{
ll mid = ((l+r)>>1);
if(ask(l, mid, num)) fi(l, mid, num);
else fi(mid+1, r, num);
}
}
void solve()
{
cin >> n;
pos.push_back(1);
A[1] = 0;
for(int i = 2; i<= n; i++)
{
if(!ask(0, pos.size()-1, i))
{
pos.push_back(i);
A[i] = pos.size()-1;
}
else
{
fi(0, pos.size()-1, i);
}
}
for(int i = 1; i<= n; i++) cout << A[i] << " ";
cout << endl;
}
signed main()
{
//ios_base::sync_with_stdio(NULL) ; cin.tie(nullptr) ; cout.tie(nullptr);
//freopen("case_06.txt","r",stdin);
//freopen("BAJ.inp","r",stdin);
//sfreopen("BAJ.out","w",stdout);
//ll x; cin >> x; Debug(x);
ll test_case = 1; //cin >> test_case;
//sang();
for(int i = 1; i<=test_case; i++)
{
//cout << n << " " << m << "\n";
//if(n==0||m==0) return 0;
solve();
}
}
Compilation message
carnival.cpp: In function 'bool ask(long long int, long long int, long long int)':
carnival.cpp:25:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | if(vl==save.size()) return 0;
| ~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
228 KB |
Integer 0 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
208 KB |
Integer 0 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Integer 0 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
208 KB |
Integer 0 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
208 KB |
Integer 0 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |