Submission #173512

#TimeUsernameProblemLanguageResultExecution timeMemory
173512LinusTorvaldsFanXoractive (IZhO19_xoractive)C++14
100 / 100
6 ms504 KiB
#include "interactive.h" using namespace std; #include <bits/stdc++.h> vector<int> guess(int n); vector<int>guess(int n) { vector<int>ans(n); ans[0]=ask(1); map<int,int>ans_pos; for(int bit=0;bit<7;bit++){ vector<int>pos; for(int i=2;i<=n;i++){ if(i&(1<<bit)){ pos.push_back(i); } } if(pos.empty())break; vector<int>q1=get_pairwise_xor(pos); pos.push_back(1); vector<int>q2=get_pairwise_xor(pos); map<int,int>cnt; for(auto x:q2){ cnt[x]++; } for(auto x:q1){ cnt[x]--; } for(auto t:cnt){ if(t.first!=0 && t.second != 0) { ans_pos[t.first^ans[0]]+=(1<<bit); } } } for(auto q:ans_pos){ ans[q.second-1]=q.first; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...