# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
182079 | stefdasca | Xoractive (IZhO19_xoractive) | C++14 | 6 ms | 376 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 "interactive.h"
#include<bits/stdc++.h>
using namespace std;
int n, sol[102];
vector<int> guess(int n)
{
sol[1] = ask(1);
map<int, int> ind;
for(int i = 0; i <= 6; ++i)
{
vector<int> vec;
for(int j = 2; j <= n; ++j)
if(j & (1<<i))
vec.push_back(j);
if(vec.empty())
continue;
vector<int> vv = vec;
vv.push_back(1);
vv = get_pairwise_xor(vv);
vec = get_pairwise_xor(vec);
map<int, int> frq;
for(int j = 0; j < vv.size(); ++j)
if(vv[j] != 0)
frq[vv[j]]++;
for(int j = 0; j < vec.size(); ++j)
if(vv[j] != 0)
frq[vv[j]]--;
for(int j = 0; j < vv.size(); ++j)
if(frq[vv[j]] != 0)
ind[(vv[j] ^ sol[1])] |= (1<<i);
}
for(auto poz : ind)
sol[poz.second] = poz.first;
vector<int> ans;
for(int i = 1; i <= n; ++i)
ans.push_back(sol[i]);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |