# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121142 | aykhn | Weirdtree (RMI21_weirdtree) | C++17 | 147 ms | 38164 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 "weirdtree.h"
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3F3F3F3F
struct DATA
{
long long mx1 = -inf, mx2 = -inf, cnt = 0, s = 0;
};
const long long MXN = 3e5 + 5;
long long n;
long long arr[MXN];
DATA st[MXN << 2];
DATA combine(DATA x, DATA y)
{
if (x.mx1 == y.mx1) return {x.mx1, max(x.mx2, y.mx2), x.cnt + y.cnt, x.s + y.s};
else if (x.mx1 > y.mx1) return {x.mx1, max(x.mx2, y.mx1), x.cnt, x.s + y.s};
else return {y.mx1, max(x.mx1, y.mx2), y.cnt, x.s + y.s};
}
void build(long long l, long long r, long long x)
{
if (l == r)
{
st[x] = {arr[l], -inf, 1, arr[l]};
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |