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 <algorithm>
using namespace std;
long long min_total_length(vector<int> r, vector<int> b)
{
// subtask 2
if (r.back() < b.front())
{
long ans = 0;
for (int x : r)
ans += r.back() - x;
for (int y : b)
ans += y - b.front();
ans += max(r.size(), b.size()) * (b.front() - r.back());
return ans;
}
return -1LL;
}
# | 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... |