# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
499305 | couplefire | Cake 3 (JOI19_cake3) | C++17 | 1348 ms | 151640 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 <iostream>
#include <algorithm>
using namespace std;
#define sz 30000000
pair<long long,int> tree[sz];
int n,m,lc[sz],rc[sz],root[200005],cn;
long long ans=-1e18;
pair<int,int> arr[200005];
void update(int node,int node2,int st,int en,int idx){
tree[node2]=tree[node];
tree[node2].first+=idx;
tree[node2].second++;
if (st!=en){
int mid=(st+en)/2;
if (st<=idx && idx<=mid){
lc[node2]=++cn;
rc[node2]=rc[node];
update(lc[node],lc[node2],st,mid,idx);
}
else{
rc[node2]=++cn;
lc[node2]=lc[node];
update(rc[node],rc[node2],mid+1,en,idx);
}
}
}
long long get(int node,int node2,int st,int en,int k){
if (st==en)
return 1LL*k*st;
int mid=(st+en)/2;
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... |