제출 #336135

#제출 시각아이디문제언어결과실행 시간메모리
336135ivan_tudorXoractive (IZhO19_xoractive)C++14
100 / 100
6 ms512 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> poz; for(int bit = 0;bit<7;bit++){ vector<int> toask; for(int i=2;i<=n;i++){ if(i & (1<<bit)) toask.push_back(i); } if(toask.size()){ vector<int> fans = get_pairwise_xor(toask); map<int,int> frv; for(auto x:fans) if(x){ frv[x] ++; } toask.push_back(1); vector<int> sans = get_pairwise_xor(toask); for(auto x:sans){ if(x){ if(frv.count(x) && frv[x] > 0) frv[x]--; else poz[x^ans[0]] |= ( 1<< bit); } } } } for(auto x:poz){ ans[x.second - 1] = x.first; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...