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>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
ll min_total_length(vector<int>r,vector<int>b){
ll ans=0,n=r.size(),m=b.size();
for(ll i=0;i<n-1;i++){
ans+=(r[i+1]-r[i])*(i+1);
}
ll cur=0;
for(ll i=m-1;i>=1;i--){
ans+=(b[i]-b[i-1])*(++cur);
}
ans+=(b[0]-r[n-1])*max(n,m);
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... |