Submission #503499

#TimeUsernameProblemLanguageResultExecution timeMemory
503499GurbanXoractive (IZhO19_xoractive)C++17
100 / 100
8 ms464 KiB
#include "bits/stdc++.h" #include "interactive.h" using namespace std; const int maxn=105; int fir; set<int>arr[10]; set<int>A(vector<int>v){ if(v.empty()) return set<int>(); vector<int>now = v; now.push_back(1); vector<int>nw = get_pairwise_xor(now); vector<int>z = get_pairwise_xor(v); multiset<int>SS(nw.begin(),nw.end()); for(auto i : z) SS.erase(SS.find(i)); set<int>jg; for(auto i : SS) jg.insert(i ^ fir); jg.erase(fir); return jg; } set<int>un(set<int>A,set<int>B){ set<int>jog; for(auto i : A) if(B.find(i) != B.end()) jog.insert(i); return jog; } vector<int> guess(int n) { fir = ask(1); for(int i = 0;i <= 6;i++){ vector<int>now; for(int j = 2;j <= n;j++) if((1 << i) & j) now.push_back(j); arr[i] = A(now); } set<int>all; for(int i = 0;i <= 6;i++) for(auto j : arr[i]) all.insert(j); vector<int>ans; ans.push_back(fir); for(int i = 2;i <= n;i++){ set<int>now; now = all; for(int j = 0;j <= 6;j++){ if((1<<j) & i) now = un(now,arr[j]); else for(auto k : arr[j]) now.erase(k); } assert(!now.empty()); ans.push_back(*now.begin()); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...