# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
122528 | baqargam | Wiring (IOI17_wiring) | C++14 | 0 ms | 0 KiB |
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"
using namespace std;
long long min_total_length(vector<long long> r, vector<long long> b) {
sort(r.begin(),r.end());
sort(b.begin(),b.end());
long long n=r.size();
long long m=b.size();
long long res=(b[0]-r[n-1])*max(n,m);
for(long long i=0;i<n;i++)
res+=r[n-1]-r[i];
for(long long i=0;i<m;i++)
res+=b[i]-b[0];
return res;
}