# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
555787 | 2022-05-01T14:30:45 Z | ngpin04 | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KB |
#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) { 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); } 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; }