Submission #958366

#TimeUsernameProblemLanguageResultExecution timeMemory
958366kilkuwuXoractive (IZhO19_xoractive)C++17
100 / 100
4 ms596 KiB
#include "interactive.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "template\debug.hpp" #else #define dbg(...) ; #define timer(...) ; #endif vector<int> guess(int N) { // ask, getpairwisexor std::vector<int> ans(N); ans[0] = ask(1); std::map<int, int> mp; for (int b = 6; b >= 0; b--) { std::vector<int> ids; for (int i = 1; i < N; i++) { if (i >> b & 1) { ids.push_back(i + 1); } } if (ids.empty()) continue; auto a1 = get_pairwise_xor(ids); ids.push_back(1); auto a2 = get_pairwise_xor(ids); std::map<int, int> ok; for (int i : a2) { ok[i]++; } for (int i : a1) { ok[i]--; } ok[0]--; dbg(ok); for (auto [f, s] : ok) { if (s > 0) { mp[f ^ ans[0]] ^= 1 << b; } } } dbg(mp); for (auto [f, s] : mp) { ans[s] = f; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...