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 ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
vector<ll>r,b;int n,m;
ll go(int x,int y)
{
ll z=abs(r[x]-b[y]);return z;
}int w=0;
long long min_total_length(vector<int> R,vector<int> B) {
if(B.size()>R.size()){swap(R,B);w=B.size()-1;}
n=R.size();m=B.size();
for(int i=0;i<m;i++){
b.pb(B[i]);
}
for(int i=0;i<n;i++){
r.pb(R[i]);
}
n=R.size();m=B.size();
ll re=0;
for(int i=0;i<n;i++)
{
re+=go(i,w);
}
for(int j=0;j<m;j++)
{
re+=abs(b[j]-b[w]);
}
return re;
}
# | 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... |