# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
623001 | ziduo | Xoractive (IZhO19_xoractive) | C++14 | 3 ms | 384 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;
#define pb push_back
#define size(x) (int)x.size()
vector<int> guess(int n)
{
vector<int> ans(n);
ans[0] = ask(1);
map<int, int> pos;
for (int i = 0; i < 7; ++i)
{
vector<int> v;
for (int mask = 2; mask <= n; ++mask) if (mask >> i & 1)
v.pb(mask);
if (v.empty())
continue;
vector<int> v1 = get_pairwise_xor(v);
v.pb(1);
vector<int> v2 = get_pairwise_xor(v);
vector<int> v3;
for (int i = 0, j = 0; j < size(v2);)
{
if (i < size(v1) && v1[i] == v2[j])
++i, ++j;
else v3.pb(v2[j++]);
}
for (int j = 1; j < size(v3); j += 2)
pos[v3[j] ^ ans[0]] += (1 << i);
}
for (auto [x, y] : pos)
ans[y-1] = x;
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |