# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092138 | juicy | Xoractive (IZhO19_xoractive) | C++17 | 4 ms | 596 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;
void sub(vector<int> &a, vector<int> b) {
for (int x : b) {
a.erase(find(a.begin(), a.end(), x));
}
}
vector<int> qry(vector<int> cnd) {
vector<int> a = cnd;
a.push_back(1);
a = get_pairwise_xor(a);
sub(a, get_pairwise_xor(cnd));
a.erase(find(a.begin(), a.end(), 0));
vector<int> nw;
for (int i = 0; i < a.size(); i += 2) {
nw.push_back(a[i]);
}
a.swap(nw);
return a;
}
vector<int> guess(int n) {
vector<int> a(n);
a[0] = ask(1);
int lg = __lg(n);
vector<vector<int>> s(lg + 1);
map<int, int> mp;
for (int j = 0; j <= lg; ++j) {
vector<int> cnd;
for (int i = 2; i <= n; ++i) {
if (i >> j & 1) {
cnd.push_back(i);
}
}
s[j] = qry(cnd);
for (int x : s[j]) {
mp[x ^ a[0]] |= 1 << j;
}
}
for (auto [x, i] : mp) {
a[i - 1] = x;
}
return a;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |