Submission #725061

#TimeUsernameProblemLanguageResultExecution timeMemory
725061FatihSolakXoractive (IZhO19_xoractive)C++17
100 / 100
5 ms464 KiB
#include "interactive.h" #include <bits/stdc++.h> using namespace std; vector<int> guess(int n) { vector<int> ans(n); ans[0] = ask(1); map<int,int> pos; for(int i = 0;i<=6;i++){ if((1<<i) > n)break; vector<int> tmp; for(int j = 2;j<=n;j++){ if(j & (1<<i)) tmp.push_back(j); } vector<int> a = get_pairwise_xor(tmp); map<int,int> mp; tmp.push_back(1); vector<int> b = get_pairwise_xor(tmp); for(auto u:a){ if(u) mp[u]--; } for(auto u:b){ if(u) mp[u]++; } for(auto u:mp){ if(u.second == 0)continue; pos[u.first ^ ans[0]] += (1<<i); } } for(auto u:pos){ ans[u.second-1] = u.first; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...