#include "bits/stdc++.h"
#include "interactive.h"
using namespace std;
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
vector<int> guess(int n) {
int a1 = ask(1);
map<int, int> m;
m[a1] = 1;
for (int x = 0; ; x++) {
vector<int> v;
for (int i = 2; i <= n; i++)
if ((i >> x) & 1) v.push_back(i);
if (v.empty()) break;
vector<int> u = get_pairwise_xor(v);
set<int> s(all(u));
v.push_back(1);
u = get_pairwise_xor(v);
set<int> t(all(u));
for (auto i : t)
if (s.find(i) == s.end()) m[i ^ a1] ^= 1 << x;
}
vector<int> v(n);
for (auto [x, y] : m)
v[y - 1] = x;
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |