#include <bits/stdc++.h>
using namespace std;
#define SPEED ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define ALL(x) x.begin(), x.end()
#define intt long long
#define pb push_back
// #define endl "\n"
const int mod = 1e9 + 7, inf = 1e9;
intt interaction(vector<intt>asked) {
cout << (intt)asked.size() << " ";
for(intt i : asked) cout << i << " ";
cout << endl;
intt X;
cin >> X;
return X;
}
void solve() {
intt N, uniqo = 2;
cin >> N;
vector<intt> ans(N + 1, 0ll), ask, memo(N + 1, 0ll);
ans[1] = 1;
ask.pb(1);
memo[1] = 1;
for(intt r = 2; r <= N; r++) {
ask.pb(r);
intt uniq = interaction(ask);
memo[r] = uniq;
if(uniq == memo[r - 1]) {
// arxaya dogru binary search ataciq
intt L = 1, R = r - 1, prevL = 0, prevR = 0;
while(L < R) {
if(prevL == L && prevR == R) break;
intt mid = (L + R) / 2;
vector<intt>sor;
for(intt i = L; i <= mid; i++) sor.pb(i);
intt prevcnt = interaction(sor);
sor.pb(r);
intt cnt = interaction(sor);
prevL = L;
prevR = R;
if(cnt != prevcnt) {
L = mid;
} else {
R = mid;
}
}
ans[r] = ans[R];
} else {
ans[r] = uniq;
}
}
cout << 0 << " ";
for(intt i = 1; i <= N; i++) {
cout << ans[i] << " ";
}
cout << endl;
}
int main() {
SPEED;
intt tst = 1;
// cin >> tst;
while (tst--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |