# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131954 | E869120 | Valley (BOI19_valley) | C++14 | 597 ms | 38776 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 <vector>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)
class RangeAddMinSegmentTree {
public:
vector<long long> dat, lazy; int size_ = 1;
void init(int sz) {
while (size_ <= sz) size_ *= 2;
dat.resize(size_ * 2, 0);
lazy.resize(size_ * 2, 0);
}
void refresh(int pos) {
if (pos < size_) {
lazy[pos * 2 + 0] += lazy[pos];
lazy[pos * 2 + 1] += lazy[pos];
lazy[pos] = 0;
dat[pos] = min(dat[pos * 2] + lazy[pos * 2], dat[pos * 2 + 1] + lazy[pos * 2 + 1]);
}
else {
dat[pos] += lazy[pos];
lazy[pos] = 0;
}
}
void add_(int l, int r, long long x, int a, int b, int u) {
if (l <= a && b <= r) { lazy[u] += x; refresh(u); return; }
if (r <= a || b <= l) return;
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... |