当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3563:Parabolic teleports

Special Judge 特殊评判
题目描述

Flatland is a plane with a Cartesian coordinate system Oxy. Citizens of Flatland are points that move with the speed 1. Consequently, the minimal time it takes for a Flatlander to move from point V to point W is equal to the length of the line segment VW. This fact is taught in the schools of Flatland as the “shortest path theorem”.

However, since George Edward Nius invented the devices called parabolic teleports, the theorem no longer holds. A parabolic teleport is a contiguous section of a parabola along which it is possible to move with infinite speed. In other words, it is possible to move from any point on the parabolic teleport to any other point on the same parabolic teleport in zero time.

The points (x, y) that belong to the teleport are given by the formulae y = A·x2+B·x+C, XLxXR, where A, B, C, XL, XR are the parameters of the teleport.

After inventing the teleports, G.E.Nius founded a company to build them. At the moment, the company has already built N of those devices. One might imagine that they are shoveling money left and right, but…

But in practice, the Flatlanders still think the shortest path theorem is true and nobody has even tried the parabolic teleports. To help the situation, G.E.Nius has hired you to write a program that, given two points V and W, would compute the time it would take to move from V to W using the teleports the company has already built. The idea is that the users of the program will see that the time is less than the length of the segment VW and start to use the invention of Mr. Nius.

Are you up to the task?

输入解释

On the first line of the file is the integer N (0 ≤ N ≤ 100), the number of the teleports. On the second line of the file are the integers XV and YV (−100 ≤ XV ≤ 100, −1 000 000YV1 000 000), the coordinates of the source point V. On the third line of the file are the integers XW and YW (−100 ≤ XW ≤ 100, −1 000 000YW1 000 000), the coordinates of the destination point W.

Each of the N following lines contains 5 integers, separated by spaces, that describe the ith teleport – giving its parameters Ai, Bi, Ci, XLi, XRi (‑100 ≤ Ai, Bi, Ci ≤ 100, Ai ≠ 0, −100 ≤ XLi < XRi ≤ 100).

输出解释

The first and only line of the file should contain one real number, the minimal time it takes to move from point A to point B. The absolute error of the answer must not exceed 10−4.

输入样例
2
0 10
0 -10
1 0 0 -10 10
-1 0 0 -10 10
输出样例
6.2450
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 1000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3563

最后修改于 2020-10-29T07:04:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000 65536