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>
using namespace std;
long long min_total_length(vector<int> r, vector<int> b) {
int ans = 0;
reverse(r.begin(), r.end());
while(r.size() > 2 && b.size() > 2) {
ans += abs(r.back()-b.back());
r.pop_back();
b.pop_back();
}
while(r.size() > 2) {
ans += abs(r.back()-b.back());
r.pop_back();
}
while(b.size() > 2) {
ans += abs(r.back()-b.back());
b.pop_back();
}
ans += abs(r.back()-b.back());
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... |