# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110954 | PeppaPig | Palembang Bridges (APIO15_bridge) | C++14 | 104 ms | 8060 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>
#define long long long
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int N = 1e5+5;
long suml, sumr;
priority_queue<long> L;
priority_queue<long, vector<long>, greater<long> > R;
void add(long x) {
if(L.empty() || x <= L.top()) {
L.emplace(x), suml += x;
int now = L.size() + R.size();
if(L.size() > (now + 1) / 2) {
long t = L.top(); L.pop();
suml -= t;
R.emplace(t), sumr += t;
}
} else {
R.emplace(x), sumr += x;
int now = L.size() + R.size();
if(R.size() > (now + 1) / 2) {
long t = R.top(); R.pop();
sumr -= t;
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... |