# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
330920 | ZwariowanyMarcin | XOR (IZhO12_xor) | C++14 | 2105 ms | 197356 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>
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
using ll = long long;
using namespace std;
const int M = 1 << 24;
int n, q, a, b, cnt, to[M][2], mn[M];
pair<int, int> res;
int add(int pos, int x) {
int v = 0;
for (int i = 30; 0 <= i; --i) {
int b = (x >> i & 1);
if (!to[v][b]) to[v][b] = ++cnt;
v = to[v][b];
mn[v] = min(mn[v], pos);
}
}
int query(int x) {
int v = 0, res = 1 << 30;
for (int i = 30; 0 <= i; --i) {
int b = (x >> i & 1);
if (q >> i & 1)
v = to[v][!b];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |