#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define popcount(x) __builtin_popcountll(x)
using namespace std;
using namespace chrono;
long long min_total_length(vector<int> r, vector<int> b) {
long long ans = 0;
for (int x : b) ans += x;
for (int x : r) ans -= x;
if (r.size() < b.size()) {
ans -= (b.size() - r.size()) * r.back();
} else {
ans += (r.size() - b.size()) * b.front();
}
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... |