#P9630. [ICPC 2020 Nanjing R] Interested in Skiing
[ICPC 2020 Nanjing R] Interested in Skiing
题目描述
Kotori is interested in skiing. The skiing field is an infinite strip going along -axis on the 2-dimensional plane where all points in the field satisfies . When skiing, Kotori cannot move out of the field, which means that the absolute value of his -coordinate should always be no more than . There are also segments on the ground which are the obstacles and Kotori cannot move across the obstacles either.
Kotori will start skiing from (you can regard this -coordinate as a negative infinity) and moves towards the positive direction of the -axis. Her vertical (parallel to the -axis) speed is always which cannot be changed, however she can control her horizontal (parallel to the -axis) speed in the interval of . The time that Kotori changes her velocity can be neglected.
Your task is to help Kotori calculate the minimum value of that once she can safely ski through the skiing field without running into the obstacles.
输入格式
There is only one test case in each test file.
The first line of the input contains three positive integers , and (, , ), indicating the number of obstacles, the half width of the skiing field and the vertical speed.
For the following lines, the -th line contains four integers , , and (, , or ) indicating the -th obstacle which is a segment connecting point and , both inclusive (that is to say, these two points are also parts of the obstacle and cannot be touched). It's guaranteed that no two obstacles intersect with each other.
输出格式
Output one line containing one number indicating the minimum value of . If it is impossible for Kotori to pass through the skiing field, output -1 (without quotes) instead.
Your answer will be considered correct if and only if its absolute or relative error does not exceed .
3 2 1
-2 0 1 0
-1 4 2 4
0 1 0 3
1.000000000000000
2 1 2
-1 0 1 0
1 1 0 1
-1
2 3 7
-3 0 2 2
3 1 -2 17
1.866666666666666
1 100 1
-100 0 99 0
0.000000000000000