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>
#include "wiring.h"
#define ll long long
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int max_r = INT_MIN, min_r = INT_MAX;
int max_b = INT_MIN, min_b = INT_MAX;
for(int i:r) {
if(i > max_r) max_r = i;
if(i < min_r) min_r = i;
}
for(int i:b) {
if(i > max_b) max_b = i;
if(i < min_b) min_b = i;
}
ll sum = (1LL * min_b - 1LL * max_r) * 1LL * max(r.size(), b.size());
for(int i:r) {
sum += 1LL * (max_r - i);
}
for(int i:b) {
sum += 1LL * (i - min_b);
}
return sum;
}
# | 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... |