# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
343349 | Tosic | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
void toMs(vector<int>& tmp, multiset<int>& ms){
for(auto i : tmp){
if(!i){
continue;
}
ms.insert(i);
}
}
map<int, int> idx;
vector<int> guess(int n){
int fr = ask(1);
for(int j = 0; j <= 6; ++j){
vector<int >a1;
for(int i = 2; i <= n; ++i){
if((i>>j)&1){
a1.push_back(i);
}
}
vector<int>a2 = a1;
if(a2.empty()){
continue;
}
for(auto y : a1){
cout << y << ' ';
}
cout << '\n';
a2.push_back(1);
a2=get_pairwise_xor(a2);
a1=get_pairwise_xor(a1);
multiset<int> tmp;
toMs(a2, tmp);
for(auto i : a1){
if(i and tmp.find(i) != tmp.end()){
tmp.erase(tmp.find(i));
}
}
for(auto i = tmp.begin(); i != tmp.end(); ++i){
idx[fr^*i] += (1<<j);
++i;
}
}
vector<int> ans(n, 0);
for(auto pr:idx){
ans[pr.second-1] = pr.first;
}
ans [0] =fr;
return ans;
}