| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 1024 MB | 83 | 57 | 53 | 67.949% |
Scott wants to ride his bike along a straight road. But the road has some barricades! Scott will ride his bike up to the first barricade and stop.
Model Scott’s straight road as the positive $Y$ axis, with Scott starting at the origin. The barricades are line segments, specified by their endpoints. Determine how far Scott can ride, or if his path is completely unobstructed.
The first line of input contains a single integer $n$ (1ドル≤n≤1,000円$), which is the number of barricades.
Each of the next nn lines contains four integers $x_1,ドル $y_1,ドル $x_2$ and $y_2$ ($-100≤x_1,y_1,x_2,y_2≤100,ドル $x_1 \ne 0,ドル $x_2 \ne 0$), representing a barricade that runs from $(x_1,y_1)$ to $(x_2,y_2)$. It is guaranteed that no barricade will run through the origin.
Output a single real number, which is how far Scott can ride before he hits the closest barricade, or $-1.0$ if no barricades get in Scott’s way. This output will be considered correct if it is within an absolute or relative error of 10ドル^{-2}$.
2 -10 7 5 19 -1 -1 8 21
1.4444444444444446
2 4 -6 -12 -1 3 5 8 8
-1.0