# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
555788 | ngpin04 | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KiB |
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>
#define fi first
#define se second
#define mp make_pair
#include "interactive.h"
#include "grader.cpp"
using namespace std;
map <int, int> pos;
void solve(int i, vector <int> p, int r, int n) {
map <int, int> cnt;
vector <int> tmp = get_pairwise_xor(p);
for (int x : tmp)
cnt[x]--;
p.push_back(n);
tmp = get_pairwise_xor(p);
for (int x : tmp) {
cnt[x]++;
if (cnt[x] > 0)
pos[x ^ r] |= (1 << i);
}
}
vector<int> guess(int n) {
int r = ask(n);
for (int j = 0; j < 7; j++) {
vector <int> p;
for (int i = 1; i < n; i++)
if (i & (1 << j))
p.push_back(i);
if (!p.size())
continue;
solve(j, p, r, n);
}
vector <int> ans(n, 0);
for (pair <int, int> pir : pos)
if (pir.fi != r)
ans[pir.se - 1] = pir.fi;
ans[n - 1] = r;
return ans;
}