#P1995. [NOI2011] 智能车比赛

    ID: 940 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp计算几何2011NOI 系列Special Judge最短路

[NOI2011] 智能车比赛

Description

A new Intelligent Vehicle contest has begun at JL University! The race track can be regarded as being formed by nn rectangular regions stitched together (as shown in the figure below). Each rectangle has sides parallel to the coordinate axes. For the ii-th rectangle, the lower-left and upper-right corners are (xi,1,yi,1)(x_{i,1}, y_{i,1}) and (xi,2,yi,2)(x_{i,2}, y_{i,2}), respectively.

It is guaranteed that xi,1<xi,2=xi+1,1x_{i,1} < x_{i,2} = x_{i+1,1} and yi,1<yi,2y_{i,1} < y_{i,2}. Any two adjacent rectangles share an overlapping edge segment (as indicated by the dashed line in the figure), and the smart car can move between rectangles through this overlap.

Participants must drive their designed smart car from a given start point SS to a given end point TT in the shortest possible time, without leaving the track. Assume the car’s speed is a constant vv, and turning takes no time. Can you compute the minimum time needed to finish the race?

Input Format

The first line contains a positive integer nn, the number of rectangles that make up the track.

The next nn lines describe the rectangles. The ii-th of these lines contains 44 integers xi,1,yi,1,xi,2,yi,2x_{i,1}, y_{i,1}, x_{i,2}, y_{i,2}, denoting that the lower-left and upper-right corners of the ii-th rectangle are (xi,1,yi,1)(x_{i,1}, y_{i,1}) and (xi,2,yi,2)(x_{i,2}, y_{i,2}), respectively.

The next line contains two integers xS,ySx_S, y_S, the coordinates of the start point.

The next line contains two integers xT,yTx_T, y_T, the coordinates of the end point.

The next line contains a real number vv, the speed of the smart car.

Output Format

Output a single real number, the minimum time for the smart car to finish the race, accurate to at least six digits after the decimal point.

For each test point, if your output differs from the reference answer by no more than 10610^{-6}, you will receive full credit for that test point; otherwise, you will receive no credit.

2  
1 1 2 2  
2 0 3 4  
1 1  
3 0  
1.0 
2.41421356

Hint

Translated by ChatGPT 5