# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342057 | dimashii | XOR (IZhO12_xor) | C++17 | 2 ms | 364 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 fastio ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
using namespace std;
const int mxN = 3e5 + 45, mod = 1e9 + 7, mxB = 29;
const ll inf = 2e18 + 43;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, x, a[mxN], sz = 1, dp[mxN * 30];
struct trie {
int nxt[2];
} t[mxN * 30];
void add(int val, int i, int v = 1, int depth = 0) {
if (depth > mxB) {
if (!dp[v]) dp[v] = i;
return;
}
if ((val >> (mxB - depth)) & 1) {
if (!t[v].nxt[1]) t[v].nxt[1] = ++sz;
add(val, i, t[v].nxt[1], depth + 1);
}else {
if (!t[v].nxt[0]) t[v].nxt[0] = ++sz;
add(val, i, t[v].nxt[0], depth + 1);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |