# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
111185 | oToToT | Palembang Bridges (APIO15_bridge) | C++14 | 100 ms | 2808 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 <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
const greater<int> gr;
struct Median {
int sz;
int mn[100007];
int mx[100007];
void clear() { sz = 0; }
long long insert(int a, int b, long long d) { // a <= b
if (!sz) return sz++, d + (*mx = b) - (*mn = a);
if (b < *mn) {
d += *mn * 2 - a - b;
mx[sz] = *mn;
pop_heap(mn, mn + sz);
mn[sz - 1] = a; mn[sz] = b;
push_heap(mn, mn + sz);
} else if (a > *mx) {
d += a + b - *mx * 2;
mn[sz] = *mx;
pop_heap(mx, mx + sz, gr);
mx[sz - 1] = a; mx[sz] = b;
push_heap(mx, mx + sz, gr);
} else {
d += b - a;
mn[sz] = a; mx[sz] = b;
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |