| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 42 | 35 | 31 | 83.784% |
Ashley has given Brandon a square of side $2024$. She also has drawn a single line segment that connects two different sides of the square.
Brandon wants to draw some additional line segments such that it is possible to decompose the square into a set of disjoint triangles, where each triangle has sides that are either subsegments of the sides of the square, or subsegments of any drawn line segment.
Compute the minimum number of additional line segments Brandon needs to draw to make this possible.
Imagine that the square is axis-aligned with its bottom-left corner at $(0, 0)$ and top-right corner at $(2024, 2024)$.
Input has a single line with four integers $x_1$, $y_1$, $x_2$, $y_2$ ($0 ≤ x_1, y_1, x_2, y_2 ≤ 2024$) specifying the coordinates of the end points of the line segment initially drawn by Ashley. One end point is at $(x_1, y_1)$ and the other end point is at $(x_2, y_2)$.
It is guaranteed the two end points are distinct. Both end points are on sides of the square. If the segment intersects a side of the square, it does so at exactly one point.
Output a single integer, the minimum number of additional line segments Brandon needs to draw.
0 10 10 0
2
2024 2024 0 0
0
ICPC > Regionals > North America > Southeast USA Regional > 2024 Southeast USA Regional Programming Contest > Division 1 B번
ICPC > Regionals > North America > Southeast USA Regional > 2024 Southeast USA Regional Programming Contest > Division 2 B번
ICPC > Regionals > North America > South Central USA Regional > 2024 South Central USA Regional Contest > Division 1 B번
ICPC > Regionals > North America > South Central USA Regional > 2024 South Central USA Regional Contest > Division 2 B번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2024 Mid-Atlantic USA Regional Contest > Division 1 B번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2024 Mid-Atlantic USA Regional Contest > Division 2 B번