# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344560 | SeDunion | Xoractive (IZhO19_xoractive) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "interactive.h"
using namespace std;
vector<int> guess(int n) {
vector <int> ans(n);
ans[0] = ask(1);
map<int,int> d;
for (int i = 0 ; (1 << i) <= n ; ++ i) {
vector<int> p;
for (int j = 2 ; j <= n ; ++ j) {
if (j >> i & 1) {
p.push_back(j);
}
}
auto p1 = get_pairwise_xor(p);
p.push_back(1);
auto p2 = get_pairwise_xor(p);
map<int,int> mp;
for (int i : p1) mp[i]++;
for (int i : p2) mp[i]--;
for (auto [i, j] : mp) if (j != 0) {
d[i] |= (1 << i);
}
}
for (auto [i, j] : d) {
ans[j - 1] = i;
}
return ans;
}