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"
#include <cassert>
#include <cstdio>
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b){
int n=r.size();
int m=b.size();
//cout <<n<<" "<<m<<endl;
long long ans=0;
if(n<m){
for (int i = m-1; i > n-1; --i)
{
ans+=abs(b[i]-r[n-1]);
}
for (int i = n-1; i >= 0; --i)
{
ans+=abs(b[i]-r[i]);
}
}else{
for (int i = n-1; i > m-1; --i)
{
ans+=abs(b[0]-r[i]);
}
for (int i = m-1; i >=0 ; --i)
{
ans+=abs(b[i]-r[i]);
}
}
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... |