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 <iostream>
using namespace std;
using ll = long long;
ll min_total_length(vector<int> r, vector<int> b) {
int p1 = 0, p2 = 0, n = (int)r.size(), m = (int)b.size();
ll ans=0;
while(p1 < n || p2 < m) {
ll x = (p1 < n)? r[p1] : r[n-1];
ll y = (p2 < m)? b[p2] : b[0];
ans += y - x;
p1++; p2++;
}
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... |