Submission #334418

#TimeUsernameProblemLanguageResultExecution timeMemory
334418nikatamlianiXoractive (IZhO19_xoractive)C++14
0 / 100
5 ms364 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; vector<int> guess(int n) { vector <int> ans; int x = ask(1); ans.push_back(x); set<int> all, s[7]; for(int bit = 0; bit < 7; ++bit) { vector<int> to_ask; for(int i = 2; i <= n; ++i) { if(i >> bit & 1) { to_ask.push_back(i); } } if(to_ask.empty()) continue; vector<int> xors_without_1 = get_pairwise_xor(to_ask); to_ask.push_back(1); vector<int> xors_with_1 = get_pairwise_xor(to_ask); map<int,int> freq; for(int i : xors_without_1) freq[i]++; for(int x : xors_with_1) { if(freq[x] == 0) { s[bit].insert(x); all.insert(x); } else { --freq[x]; } } } for(int i = 2; i <= n; ++i) { for(int val : all) { if(!val) continue; bool ok = true; for(int bit = 0; bit < 7; ++bit) { if(i >> bit & 1) { if(s[bit].find(val) == s[bit].end()) { ok = false; } } } if(ok) { ans.push_back(val); break; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...