# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
372791 | two_sides | 케이크 (JOI13_cake) | C++17 | 135 ms | 56428 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;
const int N = 300005;
const int LG = 19;
int a[N], b[N], rmq[LG][N], lg[N], ID[N];
long long ans[N], sum[2][N];
int getMin(int l, int r) {
int k = lg[r - l + 1];
return a[rmq[k][l]] <
a[rmq[k][r + 1 - (1 << k)]] ?
rmq[k][l] : rmq[k][r + 1 - (1 << k)];
}
long long getSum(int prt, int l, int r) {
return sum[prt][r] - sum[prt][l - 1];
}
void solve(int lef, int rig, long long cur) {
int mid = getMin(lef, rig);
ans[ID[mid]] += cur + a[mid];
for (int l = lef, r = rig;
l < mid || r > mid; ) {
int minP = 0;
if (l < mid) {
int p = getMin(l, mid - 1);
if (a[minP] > a[p]) minP = p;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |