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>
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define eb emplace_back
using namespace std;
typedef long long ll;
using pii = pair<int, int>;
const ll MAX = 1LL << 60;
ostream& operator<<(ostream& o, pii p){
return o << '(' << p.F << ',' << p.S << ')';
}
ll min_total_length(vector<int> r, vector<int> b) {
int n = r.size(), m = b.size();
assert(r.back() < b.front());
ll ans = 0;
if(n >= m){
for(int i : r) ans += b.front() - i;
for(int i : b) ans += i - b.front();
}
if(m >= n){
for(int i : r) ans += r.back() - i;
for(int i : b) ans += i - r.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... |