This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
//vector<int> HIDDEN = {1, 2, 1, 3, 2};
int ask(vector<int> guys) {
cout << guys.size() << " ";
for (auto i : guys) cout << i << " ";
/**
cout << endl;
set<int> s;
for (auto i : guys) s.insert(HIDDEN[i - 1]);
return s.size();
**/
int res;
cin >> res;
return res;
}
int main() {
cin >> n;
vector<int> sol(n + 1);
int cnt = 1;
sol[1] = 1;
vector<int> full;
vector<int> pref;
full.push_back(1);
pref.push_back(1);
for (int i = 2; i <= n; ++i) {
int x = ask(full);
full.push_back(i);
if (ask(full) == x + 1) {
sol[i] = ++cnt;
pref.push_back(cnt);
continue;
}
int l = 1, r = i - 1, ans = 0;
while (l <= r) {
int m = (l + r) / 2;
vector<int> query;
query.push_back(i);
for (int j = 1; j <= m; ++j) {
query.push_back(j);
}
if (ask(query) == pref[m - 1] + 1) {
l = m + 1;
ans = m;
} else {
r = m - 1;
}
}
sol[i] = sol[ans + 1];
pref.push_back(cnt);
}
cout << "0 ";
for (int i = 1; i <= n; ++i) cout << sol[i] << " ";
cout << endl;
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... |