| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 512 MB | 252 | 114 | 109 | 45.992% |
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)
int64.
min_total_length([1, 2, 3, 7], [0, 4, 5, 9, 10])
The figure below illustrates this example.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 7 | $n, m \leq 200$ |
| 2 | 13 | All red connection points have positions smaller than any blue connection points. |
| 3 | 10 | There is at least one red connection point and one blue connection point among every 7ドル$ consecutive connection points. |
| 4 | 25 | All connection points have different positions in the range $[1, n+m]$. |
| 5 | 45 | 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 min_total_length.
Olympiad > International Olympiad in Informatics > IOI 2017 > Day 1 2번
C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)