# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
618820 | MetalPower | 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 <bits/stdc++.h>
using namespace std;
#include "interactive.h"
// ask(i) := returns value at i
// get_pairwise_vector(vec) := returns a set of pairwise xor's
map<int, int> loc;
vector<int> guess(int n){
int lst = ask(n);
for(int bt = 0; bt < 7; bt++){
vector<int> vec;
for(int i = 0; i < n - 1; i++)
if(i & (1 << bt)) vec.push_back(i + 1);
vector<int> st = get_pairwise_vector(vec);
vec.push_back(n);
vector<int> fn = get_pairwise_vector(vec);
vector<int> vals;
for(int i = 0, j = 0; i < (int) st.size(); i++, j++){
while(j < (int) fn.size() && fn[j] != st[i]) vals.push_back(fn[j++]);
}
for(int j = 1; j < (int) st.size(); j++) loc[st[j]] ^= 1 << bt;
}
vector<int> ans;
ans.resize(n, 0);
for(auto x : loc) ans[x.second] = x.first;
ans[n - 1] = lst;
return ans;
}