# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
731771 | jk410 | Two Currencies (JOI23_currencies) | C++17 | 3037 ms | 36932 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 all(v) v.begin(),v.end()
#define pb push_back
#define ll long long
using namespace std;
struct segmentTree {
vector<ll> tree;
void init(int n) {
tree.clear();
tree.resize(1 << (int)ceil(log2(n)) + 1);
}
void update(int lx, int rx, ll v, int l, int r, int n) {
if (r < lx || rx < l)
return;
if (lx <= l && r <= rx) {
tree[n] += v;
return;
}
int m = (l + r) >> 1;
update(lx, rx, v, l, m, n << 1);
update(lx, rx, v, m + 1, r, n << 1 | 1);
}
ll query(int x, int l, int r, int n) {
if (r < x || x < l)
return 0;
if (l == r)
return tree[n];
int m = (l + r) >> 1;
return query(x, l, m, n << 1) + query(x, m + 1, r, n << 1 | 1) + tree[n];
}
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... |