#include "wiring.h"
#include <bits/stdc++.h>
#define fst first
#define snd second
#define pb push_back
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(),x.end()
#define forn(i,a,b) for(int i = a; i<b;i++)
#define mset(a,v) memset(a,v,sizeof(a))
using namespace std;
typedef long long ll;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
sort(ALL(r));
sort(ALL(b));
ll res = ll(b[0]-r.back())*(ll)max(SZ(r),SZ(b));
forn(i,0,SZ(r)){
res+=r.back()-r[i];
}
forn(i,0,SZ(b)){
res+=b[i]-b[0];
}
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... |