# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
50706 | edisonhello | Palembang Bridges (APIO15_bridge) | C++11 | 643 ms | 10948 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;
long long delta,ans=1ll<<60;
vector<pair<int,int>> a;
struct {
multiset<int> L,R;
long long sumL=0,sumR=0;
long long get(){
return sumR-1ll*R.size()*(*R.begin())+1ll*L.size()*(*R.begin())-sumL;
}
void meow(){
while(L.size()>R.size()+1){
R.insert(*--L.end());
sumR+=*L.begin();
sumL-=*L.begin();
L.erase(--L.end());
}
while(R.size()>L.size()+1){
L.insert(*R.begin());
sumL+=*R.begin();
sumR-=*R.begin();
R.erase(R.begin());
}
while(L.size() && R.size() && *R.begin()<*--L.end()){
int deltaL=*--L.end(),deltaR=*R.begin();
sumL=sumL-deltaL+deltaR;
sumR=sumR-deltaR+deltaL;
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... |