#include <bits/stdc++.h>
#include "wiring.h"
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int n=r.size();
int m=b.size();
long long answ=0ll;
if(n<m){
swap(r,b);
swap(n,m);
}
for(int i=0;i<n;++i){
long long e=abs(r[i]-b[min(i,m-1)])*1ll;
answ+=e;
}
return answ;
}
# | 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... |