# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872326 | MilosMilutinovic | Bitaro, who Leaps through Time (JOI19_timeleap) | C++14 | 404 ms | 524288 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;
const int N = 300000;
const int inf = (int) 1e9;
struct node {
int L, R, to;
long long cost;
node(int L = 0, int R = inf, int to = 0, long long cost = 0) : L(L), R(R), to(to), cost(cost) {}
} st[2][4 * N];
node merge(node l, node r) {
if (l.to != inf) {
return node(l.L, l.R, r.to != inf ? r.to : min(max(l.to, r.L), r.R), l.cost + r.cost + max(0, l.to - r.R));
}
if (l.R < r.L) {
return node(l.R, l.R, r.to != inf ? r.to : r.L, l.cost + r.cost);
}
if (l.L > r.R) {
return node(l.L, l.L, r.to != inf ? r.to : r.R, l.cost + r.cost + l.L - r.R);
}
return node(max(l.L, r.L), min(l.R, r.R), r.to != inf ? r.to : inf, l.cost + r.cost);
}
int n, q, from[2][N], to[2][N];
void Build(int t, int id, int l, int r) {
if (l == r) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |