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 "wiring.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll min_total_length(vector<int> r, vector<int> b) {
sort(r.begin(), r.end());
sort(b.begin(), b.end());
while (r.size() > b.size()){
b.push_back(b[0]);
}
while (r.size() < b.size()){
r.push_back(r[r.size()-1]);
}
ll sumr=0,sumb=0;
for(auto&i : r) sumr += i;
for (auto&i : b) sumb += i;
return sumb - sumr;
}
# | 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... |