Submission #333484

#TimeUsernameProblemLanguageResultExecution timeMemory
333484keko37Xoractive (IZhO19_xoractive)C++14
100 / 100
8 ms748 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; typedef vector <int> vi; vi saz; multiset <int> st, v[7]; vi guess (int n) { int val = ask(1); for (int i = 0; i < 7; i++) { vi r; for (int pos = 1; pos < n; pos++) { if ((pos & (1 << i)) == 0) r.push_back(pos + 1); } if (r.empty()) { v[i] = {val}; continue; } r.push_back(1); vi p = get_pairwise_xor(r); st.clear(); for (auto x : p) st.insert(x); r.pop_back(); p = get_pairwise_xor(r); for (auto x : p) st.erase(st.find(x)); for (auto x : st) { saz.push_back(x ^ val); v[i].insert(x ^ val); } } sort(saz.begin(), saz.end()); saz.erase(unique(saz.begin(), saz.end()), saz.end()); vi res(n); for (auto x : saz) { int pos = (1 << 7) - 1; for (int i = 0; i < 7; i++) { if (v[i].find(x) != v[i].end()) pos -= (1 << i); } res[pos] = x; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...