# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
842368 | Dec0Dedd | Cake 3 (JOI19_cake3) | C++14 | 1081 ms | 222364 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;
typedef long long ll;
typedef pair<ll, ll> pii;
const int N = 2e5+10;
const ll INF = 1e18;
struct Vertex {
Vertex *l, *r;
pii val;
Vertex(pii x) : l(nullptr), r(nullptr), val(x) {}
Vertex(Vertex *l, Vertex *r) : l(l), r(r), val({0, 0}) {
if (l) val.first+=l->val.first, val.second+=l->val.second;
if (r) val.first+=r->val.first, val.second+=r->val.second;
}
};
Vertex* build(int l, int r) {
if (l == r) return new Vertex(make_pair(0, 0));
int m=(l+r)/2;
return new Vertex(build(l, m), build(m+1, r));
}
Vertex* upd(Vertex* v, int l, int r, int p, ll nvl) {
if (l == r) {
return new Vertex(make_pair(v->val.first+nvl, v->val.second+1));
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... |