Submission #440330

#TimeUsernameProblemLanguageResultExecution timeMemory
440330dutchXoractive (IZhO19_xoractive)C++17
100 / 100
10 ms456 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; map<int, int> b; set<int> s[8]; vector<int> guess(int n){ vector<int> ans(n), a[8]; 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].size(); ++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=0; i<8; ++i) for(int j : s[7-i]) b[j] |= (1<<i); for(int i : s[0]) ans[255^b[i]] = i; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...