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;
#include "wiring.h"
long long min_total_length(vector<int> r, vector<int> b){
set<pair<int,int>>s;
for(int i=0;i<(int)r.size();i++){
s.insert({r[i],1});
}
long long res=0;
for(int i=0;i<(int)b.size();i++){
res+=abs(b[i] - s.begin()->first);
if(s.size()>1)
s.erase(s.begin());
}
if(s.size()>0){
while(s.size()!=0){
res+=abs(b[b.size()-1] - s.begin()->first);
s.erase(s.begin());
}
}
return res;
}
# | 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... |