|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||43||27||25||65.789%|
Maryam is an electrical engineer. She is designing wiring on a communication tower. On the tower there are some connection points, placed at distinct heights. A wire can be used to connect any two connection points. Each connection point can be connected to an arbitrary number of wires. There are two types of connection points: red and blue.
For the purpose of this problem the tower should be viewed as a line and the connection points as blue and red points that are at non-negative integer coordinates on this line. The length of a wire is the distance between the two connection points it connects.
Your goal is to help Maryam find a wiring scheme such that:
You should implement the following procedure:
int64 min_total_length(int r, int b)
min_total_length([1, 2, 3, 7], [0, 4, 5, 9, 10])
The figure below illustrates this example.
$n, m \leq 200$
All red connection points have positions smaller than any blue connection points.
There is at least one red connection point and one blue connection point among every $7$ consecutive connection points.
All connection points have different positions in the range $[1, n+m]$.
No additional constraints.
The sample grader reads the input in the following format:
The sample grader prints a single line containing the return value of
C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)