# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
947379 | hulahula3247 | Mountains (IOI17_mountains) | C++17 | 0 ms | 0 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>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define all(v) v.begin(), v.end()
const int INF = 0x3f3f3f3f;
int N;
struct Seg {
struct Node {int s, e, l, r, v, la, lb, sa, sb;};
vector<Node> t;
void init(int s, int e, int v) {t.push_back({s, e, -1, -1, v, INF, 0, INF, 0});}
void prop(int n, int s, int e) {
if (t[n].la != INF) {
if (t[n].la < 0) t[n].v = t[n].la*s+t[n].lb;
else t[n].v = t[n].la*e+t[n].lb;
}
else t[n].v += t[n].lb;
if (s == e) {
t[n].la = INF;
t[n].lb = 0;
return;
}
if (t[n].la != INF) {
t[n].sa = t[n].la;
t[n].sb = t[n].lb;