#include "wiring.h"
#include "bits/stdc++.h"
using namespace std;
#define ALL(x) (x.begin()), (x.end())
#define RALL(x) (x.rbegin()), (x.rend())
#define SZ(x) ((int)x.size())
#define fi first
#define se second
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
ll n = SZ(r), m = SZ(b);
sort(ALL(r));
sort(ALL(b));
ll ans = 0;
for (int i : r) ans += (ll)r[n-1]-(ll)i;
for (int i : b) ans += (ll)i-(ll)b[0];
ans += max(n, m)*(ll)(b[0]-r[n-1]);
return ans;
}
# | 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... |