# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49937 | tmwilliamlin168 | Palembang Bridges (APIO15_bridge) | C++14 | 160 ms | 6848 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;
#define ll long long
#define pii pair<int, int>
#define fi first
#define se second
const int mxN=1e5;
int k, n, pts[2*mxN], med, ft2[2*mxN+1];
ll ba, ft1[2*mxN+1], a1[mxN+1], a2=LLONG_MAX;
vector<pii> ps;
priority_queue<int> bpq;
priority_queue<int, vector<int>, greater<int>> tpq;
inline void upd(int x) {
if(x<med)
bpq.push(x);
else
tpq.push(x);
if(bpq.size()+2<=tpq.size()) {
bpq.push(med);
med=tpq.top(), tpq.pop();
} else if(bpq.size()>=tpq.size()+2) {
tpq.push(med);
med=bpq.top(), bpq.pop();
}
for(int i=upper_bound(pts, pts+2*ps.size(), x)-pts; i<=2*ps.size(); i+=i&-i)
ft1[i]+=x, ++ft2[i];
}
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... |