Submission #287889

#TimeUsernameProblemLanguageResultExecution timeMemory
287889oolimryXoractive (IZhO19_xoractive)C++14
100 / 100
7 ms520 KiB
#include "interactive.h" #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define sz(x) (int) (x).size() using namespace std; typedef long long lint; typedef pair<int,int> ii; using namespace std; int one; set<int> getxor(vector<int> pos){ if(pos.empty()) return {}; vector<int> exclude = get_pairwise_xor(pos); pos.push_back(1); vector<int> include = get_pairwise_xor(pos); set<int> res; multiset<int> res2; for(int x : include){ if(x != 0) res2.insert(x); } for(int x : exclude){ if(x != 0) res2.erase(res2.find(x)); } for(int x : res2) res.insert(x ^ one); return res; } map<int, int> M; vector<int> guess(int n){ vector<int> ans(n); one = ask(1); ans[0] = one; 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); } } set<int> S = getxor(pos); for(int x : S) M[x] += (1 << bit); } for(ii m : M) ans[m.second-1] = m.first; //cout << m.first << " " << m.second << "\n"; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...