# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102477 | AngusRitossa | Cake 3 (JOI19_cake3) | C++14 | 2252 ms | 197944 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;
int n, m;
ll ans = -1e15;
pair<ll, ll> a[200010];
struct Node
{
ll val, am, left, right;
};
Node rangetree[10000000];
int upto;
int roots[200010];
void update(ll node, int curr, int oldcurr, int cstart = 0, int cend = 1e9+1)
{
if (cstart == cend)
{
rangetree[curr].val = rangetree[oldcurr].val + node;
rangetree[curr].am = rangetree[oldcurr].am + 1;
return;
}
int mid = (cstart+cend)/2;
if (node <= mid)
{
rangetree[curr].right = rangetree[oldcurr].right;
rangetree[curr].left = ++upto;
update(node, rangetree[curr].left, rangetree[oldcurr].left, cstart, mid);
}
else
{
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... |