#P1354. 房间最短路问题

    ID: 351 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>数学计算几何福建省历届夏令营

房间最短路问题

Description

In a room with both length and width equal to 1010, with the entrance and exit at (0,5)(0,5) and (10,5)(10,5) respectively, there are several walls, each with two gaps. Find the shortest path from the entrance to the exit.

Input Format

The first line contains nn (n20n \le 20), the number of walls.

The next nn lines each contain 55 real numbers x,a1,b1,a2,b2x, a_1, b_1, a_2, b_2.

xx is the xx-coordinate of the wall (all walls are vertical). The segments between a1b1a_1 \sim b_1 and a2b2a_2 \sim b_2 are openings.

a1,b1,a2,b2a_1, b_1, a_2, b_2 are in increasing order, and x1xnx_1 \sim x_n are also in increasing order.

Output Format

Output the shortest distance, keeping 22 decimal places.

2
4 2 7 8 9
7 3 4.5 6 7

10.06

Hint

Translated by ChatGPT 5