# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
767327 | APROHACK | 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 "wiring.h"
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define ll long long
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int ir = r.size() -1 ; ib = 0;
ll ans = 0;
while(ir >= 0 and ib < b.size()){
ans += b[ib] - r[ir];
ir--;
ib++;
}
while(ir >= 0){
ans += b[0] - r[ir];
ir--;
}
while(ib < b.size()){
ans += b[ib] - r.back();
ib++;
}
return ans;
}