# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104683 | promota | Wiring (IOI17_wiring) | C++14 | 0 ms | 0 KiB |
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 <iostream>
#define ll long long int
using namespace std;
ll min_total_length(int n,int m,int r[],int b[]){
int minLen=0;
for(int j=0;j<n-1;j++){
minLen += b[0]-r[j];
}
for(int i=1;i<m;i++){
minLen += b[i]-r[n-1];
}
return minLen;
}
int main()
{
int n,m;
cin>>n>>m;
int r[n],b[m];
for(int i=0;i<n;i++){
cin>>r[i];
}
for(int i=0;i<n;i++){
cin>>b[i];
}
cout<<min_total_length(n,m,r,b);
return 0;
}