QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 256 MB 總分: 100

#10458. Intelligent Car Competition

统计

The new Intelligent Car Competition has begun at JL University! The race track can be viewed as being composed of $n$ rectangular regions joined together (as shown in the figure below). The sides of each rectangle are parallel to the coordinate axes. The coordinates of the bottom-left and top-right corners of the $i$-th rectangular region are $(x_{i,1}, y_{i,1})$ and $(x_{i,2}, y_{i,2})$, respectively.

The problem guarantees: $x_{i,1} < x_{i,2} = x_{i+1,1}$, and $y_{i,1} < y_{i,2}$. Adjacent rectangles must have an overlapping side (as shown by the dashed lines in the figure), and the intelligent car can pass between rectangular regions through this overlapping part.

x y 0 1 2 3 4 1 2 3 4 S T ① ②

Participants need to find the fastest time for their designed intelligent car to travel from a given starting point $S$ to a given destination point $T$, without the car running off the track. Assuming the speed of the intelligent car is constant at $v$ and turning consumes no time, can you calculate the minimum time required to complete the race?

Input

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

The next $n$ lines describe these rectangles, where the $i$-th line contains 4 integers $x_{i,1}, y_{i,1}, x_{i,2}, y_{i,2}$, representing the coordinates of the bottom-left and top-right corners of the $i$-th rectangle as $(x_{i,1}, y_{i,1})$ and $(x_{i,2}, y_{i,2})$.

The next line contains two integers $x_S, y_S$, representing the coordinates of the starting point.

The next line contains two integers $x_T, y_T$, representing the coordinates of the destination point.

The next line contains a real number $v$ ($1 \le v \le 10$), representing the speed of the intelligent car.

Output

Output a single real number, accurate to at least six decimal places, representing the minimum time for the intelligent car to complete the race.

Scoring

For each test case, if your output result differs from the reference result by no more than $10^{-6}$, you will receive full marks for that test case; otherwise, you will receive no marks.

Examples

Input 1

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

Output 1

2.41421356

Constraints

The range and characteristics of all test data are shown in the table below:

Test Case ID $n$ Scale Constraints
1 $n \le 1$ All coordinates are integers
2 $n \le 5$ and their absolute values
3 do not exceed $40000$
4
5 $n \le 200$
6
7 $n \le 2000$
8
9
10

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.