# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
815552 | EntityPlantt | XORanges (eJOI19_xoranges) | C++14 | 108 ms | 7172 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 <vector>
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
class segment_tree {
int n;
vector <int> tree;
public:
segment_tree(vector <int> &v) {
n = 1 << int(ceil(log2(v.size())));
tree.resize((n << 1) - 1, 0);
copy(v.begin(), v.end(), tree.begin() + n - 1);
for (int i = n - 2; i >= 0; i--) {
tree[i] = tree[(i << 1) + 1] ^ tree[(i << 1) + 2];
}
}
int size() { return n; }
void set(int i, const int &val) {
i += n - 1;
tree[i] = val;
while (i) {
i = i - 1 >> 1;
tree[i] = tree[(i << 1) + 1] ^ tree[(i << 1) + 2];
}
}
int get(int l, int r, int node = 0, int cl = 0, int cr = -1) {
if (cr < 0) cr = n - 1;
if (cl == l && cr == r) return tree[node];
if (cl > r || cr < l) return 0;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |