# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130585 | reda | 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<bits/stdc++.h>
#include "wiring.h"
#define ll long long
using namespace std ;
ll min_total_length(int r[], int b[])
{
ll sr = sizeof(r) / sizeof(int);
ll sb = sizeof(b) / sizeof(int);
ll c=0;
for(int i=0;i<min(sr,sb);i++)
{
c+=abs(r[i%sr]-b[i%sb]);
}
if(sb<sr){
for(int i = sb ;i<sr;i++ )
c+=abs(r[sr-1]-b[i]);
}
else for(int i = sr ;i<sb;i++ )
c+=abs(b[sb-1]-r[i]);
return c;
}