# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1132308 | stdfloat | Xoractive (IZhO19_xoractive) | C++20 | 0 ms | 0 KiB |
#include "bits/stdc++.h"
#include "interactive.h"
#include "grader.cpp"
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 < 7; x++) {
vector<int> v;
for (int i = 2; i <= n; i++)
if ((i >> x) & 1) v.push_back(i);
if (v.empty()) continue;
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;
}