# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
674196 | MohamedFaresNebili | Triple Jump (JOI19_jumps) | C++14 | 1008 ms | 84260 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;
#define int ll
int N, Q, A[500005], res[500005];
array<int, 3> ST[2000005];
void build(int v, int l, int r) {
if(l == r) {
ST[v] = {A[l], 0, A[l]};
return;
}
build(v * 2, l, (l + r) / 2);
build(v * 2 + 1, (l + r) / 2 + 1, r);
ST[v][0] = max(ST[v * 2][0], ST[v * 2 + 1][0]);
ST[v][1] = max(ST[v * 2][1], ST[v * 2 + 1][1]);
ST[v][2] = max({ST[v * 2][2], ST[v * 2 + 1][2], ST[v * 2][1] + ST[v * 2 + 1][0]});
}
void update(int v, int l, int r, int p, int val) {
if(l == r) {
ST[v][1] = max(ST[v][1], val);
ST[v][2] = ST[v][0] + ST[v][1];
return;
}
int md = (l + r) / 2;
if(p <= md) update(v * 2, l, (l + r) / 2, p, val);
else update(v * 2 + 1, (l + r) / 2 + 1, r, p, val);
ST[v][0] = max(ST[v * 2][0], ST[v * 2 + 1][0]);
# | 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... |