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 "wiring.h"
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int n=r.size(),m=b.size();
if(r.back()<b[0]){
reverse(all(b));
ll res=0;
if(n<=m){
for(int i=0;i<n;i++){
res+=b[i]-r[i];
}
for(int i=n;i<m;i++){
res+=b[i]-r.back();
}
}else{
for(int i=0;i<m;i++){
res+=b[i]-r[i];
}
for(int i=m;i<n;i++){
res+=b.back()-r[i];
}
}
return res;
}
return 0;
}
# | 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... |