# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
521911 | dostigator | 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 <bits/stdc++.h>
using namespace std;
vector<int> guess(int n) {
vector <int> ans(n+2);
int base=ask(1);
ans[1]=base;
map<int,int>res;
for(int i=0; i<7; ++i){
vector<int>v;
for(int x=1; x<=n; ++x) if((x>>i)&1) v.pb(x);
vector<int>get=get_pairwise_xor(v);
v.pb(1);
vector<int>GET=get_pairwise_xor(v);
for(int x:get) mp[x]++;
for(int x:GET){
if(mp[x]==0){
res[x^base]|=(1<<i);
}
mp[x]--;
}
}
for(int i=2; i<=n; ++i){
ans[res[i]]=i;
}
return ans;
}