#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pp pop_back
#define endl '\n'
#define ff first
#define ss second
#define stop exit(0)
#define sz(x) (int)x.size()
#define pause system("pause")
#define all(x) (x).begin(), (x).end()
#define deb(x) cout << #x << "-" << x << endl
typedef char chr;
typedef string str;
typedef long long ll;
typedef vector<int> vii;
typedef pair<int, int> pii;
const long long INF = LLONG_MAX;
const int inf = INT_MAX;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const int dx[] = {0, 0, -1, 1};
const int dy[] = {-1, 1, 0, 0};
const double PI = 2 * acos(0.0);
const int N = 15e1 + 5;
int n,c;
int ans[N];
vector <int> v;
int ask(vector <int> v) {
cout << sz(v) << " ";
for (auto x:v) {
cout << x << " ";
}
cout << endl;
cout.flush();
int x;
cin >> x;
return x;
}
bool check(int mid, int x) {
vii v1;
for (int i = 0; i <= mid; i++) {
v1.pb(v[i]);
}
v1.pb(x);
return (ask(v1) == mid+1);
}
inline void test_case() {
cin >> n;
for (int i = 1; i <= n; i++) {
v.pb(i);
if (ask(v) > c) {
c++;
} else {
v.pp();
}
}
for (int i = 1; i <= n; i++) {
ans[i] = -1;
}
for (int i = 0; i < sz(v); i++) {
ans[v[i]] = i+1;
}
for (int i = 1; i <= n; i++) {
if (ans[i] != -1) continue;
// deb(i);
int l = 0; int r = sz(v)-1;
while (l <= r) {
int mid = (l+r)/2;
if (check(mid,i)) {
ans[i] = mid+1;
r = mid - 1;
} else {
l = mid + 1;
}
}
}
cout << 0 << " ";
for (int i = 1; i <= n; i++) {
cout << ans[i] << " ";
}
cout << endl;
cout.flush();
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int T = 1;
// cin >> T;
while (T--) {
test_case();
}
return 0;
}
# | 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... |