Submission #1049037

#TimeUsernameProblemLanguageResultExecution timeMemory
1049037NeroZeinXoractive (IZhO19_xoractive)C++17
100 / 100
3 ms540 KiB
#include "interactive.h" #include <bits/stdc++.h> using namespace std; vector<int> guess(int n) { vector <int> ans(n); ans[0] = ask(1); map<int, int> ind; for (int b = 0; (1 << b) < n; ++b) { vector<int> vec; for (int i = 0; i < n; ++i) { if (i >> b & 1) { vec.push_back(i + 1); } } vector<int> lst = get_pairwise_xor(vec); map<int, int> cnt; for (int i : lst) { cnt[i]++; } vec.push_back(1); cnt[0]--; vector<int> lst2 = get_pairwise_xor(vec); for (int i : lst2) { if (cnt[i] == 0) { ind[i] |= 1 << b; } else { cnt[i]--; } } } for (auto [element, index] : ind) { ans[index] = element ^ ans[0]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...