This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Template path: /home/mohammed/.config/sublime-text-3/Packages/User
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
long long szr = r.size();
long long szb = b.size();
reverse(b.begin(), b.end());
long long total = 0;
for (int i = 0 ; i < szr - 1; i++) {
total += ((long long)abs(r[i] - r[i + 1])) * (i + 1);
}
for (int i = 0 ; i < szb - 1; i++) {
total += ((long long)abs(b[i] - b[i + 1]) ) * (i + 1);
}
total += ((long long)abs(r[szr - 1] - b[szb - 1])) * max(szr, szb);
return total;
}
# | 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... |