# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
922119 | 406 | Bitaro, who Leaps through Time (JOI19_timeleap) | C++17 | 685 ms | 105380 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.
//besmellah
//mage mikhad chi beshe?
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define int long long
const int64_t INF = 1ll << 60;
const int N = 3e5 + 50;
int n, q, A[N], B[N], C[N], D[N], P[N], t[N], L[N], R[N], query_ans[N];
struct node {
int mxl, mnr, fil, fir, ansl, ansr, locl, locr;
};
int dist(int l, int r) {
return max(r - l, 0ll);
}
void calc(node x, int l, int &rel, int &reans) {
if (x.mxl <= x.mnr) {
rel = min(max(l, x.mxl), x.mnr);
reans += dist(rel, l);
}
else {
int dl = dist(x.fil, l) + x.ansl;
int dr = dist(x.fir, l) + x.ansr;
if (dl < dr) {
reans += dl;
rel = x.locl;
}
else {
reans += dr;
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... |