# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169169 | 2019-12-18T19:00:37 Z | RafaelSus | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 5; typedef long long ll; #define pb push_back int[] guess(int n){ int res[n],p=0; if(n<=4){ for(int i=0;i<n;i++) res[i]=ask(i+1); return res; } res[0]=ask(1); vector<int>idx[7][3]; for(int i=2;i<=n;i++){ for(int j=0;j<=6;j++){ idx[j][(i>>j)%2].push_back(i); } } vector<int>a[7]; set<int>all; set<int>h[7][2]; for(int i=0;i<=6;i++){ vector<int>v1=get_pairwise_xor(idx[i][1]); idx[i][1].push_back(1); vector<int>v2=get_pairwise_xor(idx[i][1]); idx[i][1].pop_back(); multiset<int>fi,se; for(int i=0;i<v1.size();i++)fi.insert(v1[i]); for(int i=0;i<v2.size();i++)se.insert(v2[i]); for(auto x:fi) se.erase(se.find(x)); vector<int>tmp; for(auto x:se) tmp.insert(x^res[0]); tmp.erase(res[0]); for(auto x:tmp) all.insert(x); h[i][1]=tmp; } for(int i=0;i<=6;i++){ h[i][0]=all; for(auto x:h[i][1]) h[i][0].erase(x); } for(int i=2;i<=n;i++){ set<int>tmp=all; for(int j=0;j<=6;j++){ for(auto x:all){ if(h[j][(i>>j)%2].find(x)==h[j][(i>>j)%2].end()) tmp.erase(x); } } res[i-1]=*tmp.begin(); } return res; }