Submission #287872

#TimeUsernameProblemLanguageResultExecution timeMemory
287872dvdg6566Xoractive (IZhO19_xoractive)C++14
100 / 100
7 ms640 KiB
#include "interactive.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pi; typedef vector<int> vi; typedef vector<pi> vpi; #define pb emplace_back #define mp make_pair #define f first #define s second #define SZ(x) (int)x.size() #define ALL(x) x.begin(),x.end() #define lb lower_bound const int MAXN=1001000; const ll MOD=998244353; set<int> V[10]; int N; set<int> query(vi A){ if(SZ(A) == 0){ set<int> K; return K; } vi a = get_pairwise_xor(A); A.pb(N); vi b = get_pairwise_xor(A); multiset<int> M; for(auto i:b)M.insert(i); for(auto i:a)M.erase(M.find(i)); A.pop_back(); set<int> T; for(auto i:M)T.insert(i); T.erase(0); assert(SZ(T) == SZ(A)); return T; } vector<int> guess(int n) { N=n; int lst=ask(n); set<int> universe; for(int i=0;i<7;++i){ vi X; for(int w=1;w<N;++w){ if(w & (1<<i))X.pb(w); } if(!SZ(X))continue; V[i] = query(X); for(auto t:V[i])universe.insert(t); } vector <int> ans; // if(n > 1)universe.insert(ask(n-1) ^ lst); for(int i=1;i<N;++i){ for(auto curv:universe){ int fail = 0; for(int k=0;k<7;++k){ int a = (V[k].find(curv) != V[k].end()); int b = ((1<<k) & i) > 0; if(a!=b)fail=1; } if(fail)continue; ans.pb(curv^lst); } } ans.pb(lst); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...