# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958710 | Darren0724 | 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"
#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
vector<int> guess(int n) {
vector<int> rec(n);
rec[0]=ask(1);
map<int,int> ans;
for(int i=1;i<=n;i=i<<1){
vector<int> r;
for(int j=2;j<=n;j++){
if(j&i)r.push_back(j);
}
map<int,int> m;
auto v1=get_pairwise_xor(r);
r.push_back(1);
auto v2=get_pairwise_xor(r);
for(int j:v2)m[j]++;
for(int j:v1)m[j]--;
for(auto [a,b]:m){
if(b!=0){
ans[a]|=i;
}
}
}
for(auto [a,b]:ans){
if(a==0)continue;
rec[b-1]=a^rec[0];
}
return rec;
}