# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
728039 | bitaro1337 | Xoractive (IZhO19_xoractive) | C++14 | 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, 0);
ans[0] = get(1);
map<int, int> pos;
for(int i = 0; i < 7; ++i) {
vector<int> v;
for(j = 1; j < n; ++j) {
if(j >> i & 1) {
v.push_back(j + 1);
}
}
vector<int> A = get_pairwise_xor(v);
v.push_back(1);
vector<int> B = get_pairwise_xor(v);
map<int, int> cnt;
for(auto x: A) if(x) ++cnt[x];
for(auto x: B) if(x) --cnt[x];
for(auto x: cnt) {
if(x.second) {
pos[x.first ^ ans[0]] += (1 << i);
}
}
}
for(auto x: pos) ans[x.second] = x.first;
return ans;
}