// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(ll i=(a);i<=(b);i++)
#define Ford(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define fi first
#define se second
//#define endl "\n"
using namespace std;
int Dx[] = {0, 1, 0, -1, -1, -1, 1, 1};
int Dy[] = {-1, 0, 1, 0, 1, -1, 1, -1};
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
const ll inf = 1000000000000000000;
const ll N = 100000;
const int block_size = 300;
const ll MOD = 998244353; /* 998244353 */
const int LG = 18;
const int K = 20;
const int M = 1000000;
ll nph(ll k, ll x) { return ((x >> k) & 1); }
void Solve() {
ll n,x,y; cin>>n; ll pre[n+3]; pre[0] = 0;
vector<ll> justask;
vector<vector<ll>> ans; ans.pb({});
For(i, 1, n) {
cout << i << " ";
for(auto x : justask) cout << x << " ";
cout << i << endl;
justask.pb(x);
cin>>x; pre[i] = x;
if(pre[i] != pre[i-1]) ans.pb({i});
else {
ll l = 1, r = ans.size() - 1, pos;
while(l <= r) {
ll md = l + r >> 1;
vector<ll> v;
For(j, 1, md) {
for(auto x : ans[j]) v.pb(x);
}
cout << v.size() + 1 << " ";
for(auto x : v) cout << x << " ";
cout << i << endl;
cin>>x;
if(x > pre[v.size()]) {
pos = md; l =md + 1;
}
else r = md - 1;
}
ans[pos + 1].pb(i);
}
}
ll idk[n+3], cnt = 1;
for(ll i = 1; i < ans.size(); i++) {
for(auto y : ans[i]) {
idk[y] = cnt;
}
cnt++;
}
cout << 0 << " ";
For(i, 1, n) cout << idk[i] << " ";
}
int main() {
// freopen("Bai2.inp", "r", stdin);
// freopen("Bai2.out", "w", stdout);
ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
int t = 1;
//cin>>t;
while(t--)
Solve();
}
Compilation message
carnival.cpp: In function 'void Solve()':
carnival.cpp:40:27: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
40 | ll md = l + r >> 1;
| ~~^~~
carnival.cpp:58:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | for(ll i = 1; i < ans.size(); i++) {
| ~~^~~~~~~~~~~~
carnival.cpp:27:12: warning: unused variable 'y' [-Wunused-variable]
27 | ll n,x,y; cin>>n; ll pre[n+3]; pre[0] = 0;
| ^
carnival.cpp:54:21: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
54 | ans[pos + 1].pb(i);
| ~~~~^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |