# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
139289 | Mahmoud_Adel | Cake 3 (JOI19_cake3) | C++14 | 1406 ms | 143324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
const int N = 2e5+5;
ll n, k, cn, ans = -1e18;
ll root[N], lc[N*40], b[N], rc[N*40];
pair<ll, ll> tree[N*40];
vector<pair<ll, ll>> comp;
pair<ll, ll> p[N];
void merge(int node)
{
tree[node].f = tree[lc[node]].f+tree[rc[node]].f;
tree[node].s = tree[lc[node]].s+tree[rc[node]].s;
}
void build(int node = 0, int l=0, int r=n-1)
{
if(l == r)
{
tree[node] = {1, comp[l].f};
//cout << node << " " << tree[node].f << " " << tree[node].s << " | " << l << " " << r << endl;
return ;
}
int mid = (l+r)>>1;
lc[node] = ++cn, rc[node] = ++cn;
build(lc[node], l, mid);
build(rc[node], mid+1, r);
merge(node);
//cout << node << " " << tree[node].f << " " << tree[node].s << " | " << l << " " << r << endl;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |