Submission #287871

#TimeUsernameProblemLanguageResultExecution timeMemory
287871dvdg6566Xoractive (IZhO19_xoractive)C++14
88 / 100
10 ms1024 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); // cerr<<lst<<'\n'; vi T; for(int i=1;i<n;++i)T.pb(i); set<int> X = query(T); // for(auto i:X)cerr<<(i^lst)<<' ';cerr<<'\n'; 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 i:X)cerr<<i<<' ';cerr<<'\n'; // for(auto i:K)cerr<<i<<' ';cerr<<'\n'; // cerr<<'\n'; } vector <int> ans; for(int i=1;i<N;++i){ for(auto curv:X){ 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); // cout<<(curv^lst)<<'\n'; // cerr<<i<<' '<<curv<<' '<<fail<<'\n'; } } ans.pb(lst); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...