Problem J
Parakoopa Projectile
There are $N$ Parakoopas scattered across the first quadrant of the Cartesian plane (positive $x$ and $y$ coordinates), and Mario stands at the origin, located at $(0,0)$, waiting to put a well-known proverb to the test. He wants to hit two parakoopas (he’s fine hitting more too) with one snowball throw, where a throw is a parabola from his starting point at the origin. The throw can be modeled by the equation of a parabola $y = a(x-h)^2+k$ with $a < 0$ (since gravity pulls all projectile downwards). The only constraints on $a, h, k$ are that $a$ must be negative and the parabola must pass through the origin. Mario wants to show off to his brother Luigi while exerting the least amount of effort as possible, so he decides to throw the snowball the shortest distance possible while still hitting at least two parakoopas. Determine the shortest distance in the $x$-direction that he can throw the snowball, given that the snowball stops moving when it hits the ground at the x-axis.
Input
The first line of the input contains a single integer
$2 \leq n \leq 100\, 000$,
which denotes the number of parakoopas.
The next $n$ lines each
contain a pair of space separated integers $x,y$ denoting the coordinates of a
parakoopa. The coordinates satisfy $0 < x,y \leq 10^{18}$. The test
data for this problem is constructed in such a way that there
exists a snowball throw that satisfies the constraints.
Output
Output a single real number denoting the minimum distance that Mario can throw the snowball, while still hitting at least two parakoopas. Your answer will be considered correct if it has a relative or absolute error of at most $10^{-6}$. It is guaranteed that the answer will be less than $10^{18}$.
Sample Input 1 | Sample Output 1 |
---|---|
3 3 2 1 3 2 3 |
3.0 |