Submission #555789

#TimeUsernameProblemLanguageResultExecution timeMemory
555789ngpin04Xoractive (IZhO19_xoractive)C++14
100 / 100
5 ms404 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...