Submission #551319

#TimeUsernameProblemLanguageResultExecution timeMemory
551319krit3379Xoractive (IZhO19_xoractive)C++17
100 / 100
3 ms344 KiB
#include<bits/stdc++.h> using namespace std; #include"interactive.h" #define N 105 vector<int> guess(int n){ int i,j,ia,ib; map<int,int> mp; vector<int> ans(n); ans[n-1]=ask(n); for(i=0;i<7;i++){ vector<int> v,a,b; for(j=1;j<n;j++)if(j&(1<<i))v.push_back(j); if(v.empty())continue; a=get_pairwise_xor(v); v.push_back(n); b=get_pairwise_xor(v); for(ia=a.size()-1,ib=b.size()-1;ia>=0&&ib>=0;ib--){ if(a[ia]==b[ib]){ a.pop_back(); swap(b[ib],b.back()); b.pop_back(); ia--; } } for(auto x:b)mp[x^ans[n-1]]|=1<<i; } for(auto [x,y]:mp)ans[y-1]=x; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...