Submission #440326

#TimeUsernameProblemLanguageResultExecution timeMemory
440326dutchXoractive (IZhO19_xoractive)C++17
100 / 100
11 ms456 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; vector<int> a[8]; set<int> s[8]; int N; int find(int l, int r, int lvl, int v){ if(r - l == 1) return l; int m = (l + r) / 2; if(s[lvl].find(v) == s[lvl].end()) return find(m, r, lvl+1, v); else return find(l, m, lvl+1, v); } vector<int> guess(int n){ vector<int> ans(N=n); ans[n-1] = ask(n); for(int i=1; i<n; ++i) a[0].push_back(i); for(int i=0; i<7; ++i) for(int j=0; j<n-1; ++j) if(!(j & (1<<i))) a[7-i].push_back(j+1); for(int i=1; i<8 && !a[i].empty(); ++i){ vector<int> x = get_pairwise_xor(a[i]); a[i].push_back(n); vector<int> y = get_pairwise_xor(a[i]); for(int j : x) y.erase(lower_bound(y.begin(), y.end(), j)); for(int j : y) if(j) s[i].insert(j ^ ans[n-1]), s[0].insert(j ^ ans[n-1]); } for(int i : s[0]) ans[find(1, 129, 1, i)-1] = i; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...