# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774792 | adaawf | Addk (eJOI21_addk) | C++14 | 234 ms | 7428 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 <iostream>
#include <deque>
using namespace std;
long long int a[100005], d[1000005], lazy[1000005];
void push(int v, int tl, int tr) {
int mid = (tl + tr) / 2;
d[v * 2] += lazy[v] * (mid - tl + 1);
d[v * 2 + 1] += lazy[v] * (tr - mid);
lazy[v * 2] += lazy[v];
lazy[v * 2 + 1] += lazy[v];
lazy[v] = 0;
}
void update(int v, int tl, int tr, int l, int r, long long int x) {
if (l > r) return;
if (tl == l && tr == r) {
d[v] += x * (r - l + 1);
lazy[v] += x;
return;
}
push(v, tl, tr);
int mid = (tl + tr) / 2;
update(v * 2, tl, mid, l, min(r, mid), x);
update(v * 2 + 1, mid + 1, tr, max(l, mid + 1), r, x);
d[v] = d[v * 2] + d[v * 2 + 1];
}
long long int sum(int v, int tl, int tr, int l, int r) {
if (l > r) return 0;
if (tl == l && tr == r) {
return d[v];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |