이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef NYAOWO
#include "grader.cpp"
#endif
#include "wiring.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i <= b; i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
#define int LL
using namespace std;
using LL = long long;
using i32 = int32_t;
using pii = pair<int, int>;
int solve_13(vector<i32> &v1, vector<i32> &v2) {
int tot = 0;
For(i, 1, sz(v1) - 1) {
tot += (v1[i] - v1[i - 1]) * i;
}
Forr(i, sz(v2) - 2, 0) {
tot += (v2[i + 1] - v2[i]) * (sz(v2) - i - 1);
}
tot += (v2.front() - v1.back()) * max(sz(v1), sz(v2));
return tot;
}
int min_total_length(vector<int32_t> r, vector<int32_t> b) {
return solve_13(r, b);
}
/*
4 5
1 2 3 7
0 4 5 9 10
10
*/
# | 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... |