# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
851192 | epicci23 | 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,0);
map<int,int> go;
ans[0]=ask(1);
for(int i=0;i<7;i++){
vector<int> cur;
for(int j=2;j<=n;j++){
if(j>>i&1) cur.pb(j);
}
map<int,int> mp2,mp3;
vector<int> gg=get_pairwise_xor(cur);
for(int x:gg) mp2[x]++;
for(int j=0;j<sz(cur);j++) mp2[0]--;
for(auto& x:mp2) x.ss/=2;
cur.pb(1);
gg=get_pairwise_xor(cur);
for(int x:gg) mp3[x]++;
for(int j=0;j<sz(cur);j++) mp3[0]--;
for(auto& x:mp3) x.ss/=2;
for(auto x:mp2) mp3[x.ff]-=x.ss;
for(auto x:mp3){
if(x.ss){
go[x.ff^ans[0]]|=1LL<<i;
}
}
}
for(auto x:go) ans[x.ss-1]=x.ff;
return ans;
}