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;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
vi R, B;
long long min_total_length(std::vector<int> _R, std::vector<int> _B)
{
R.resize(sz(_R)), B.resize(sz(_B));
for (int i = 0; i < sz(_R); ++i)
R[i] = _R[i];
for (int i = 0; i < sz(_B); ++i)
B[i] = _B[i];
ll ans = 0;
for (int i = 0; i < sz(R); ++i)
ans += B.front() - R[i];
for (int i = 0; i < sz(B); ++i)
ans += B[i] - R.back();
ans -= (B.front() - R.back()) * min(sz(R), sz(B));
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... |