#P2333. Minimum Radius for Sufficient Visibility Through Circular Hole

    ID: 15607 Type: Default 1000ms 256MiB

Minimum Radius for Sufficient Visibility Through Circular Hole

Minimum Radius for Sufficient Visibility Through Circular Hole

Given a convex polygon whose vertices are provided in order and with the guarantee that the origin ((0,0)) lies strictly in its interior, you are to determine the minimum radius (r) of a circular hole (centered at ((0,0))) such that the area of the polygon visible through the hole is at least (S). In other words, if you take the intersection of the polygon and the circle of radius (r), its area should be at least (S).

Note: The area of a circular segment (the region between a chord and the corresponding arc) can be computed using the formula

[ \textstyle 0.5,r^2\Bigl(\theta - \sin\theta\Bigr), ]

where (\theta) is the central angle (in radians) corresponding to the arc.

Your task is to choose an appropriate (r) (by, for example, binary searching on (r)) so that the intersection area between the polygon and the circle is at least (S) (with an acceptable error of at most (10^{-6})).

inputFormat

The first line contains an integer (n) and a real number (S) where (3 \le n \le 10^5) and (0 < S \le A) (with (A) being the area of the polygon). The next (n) lines each contain two real numbers (x) and (y) representing the coordinates of the vertices of the convex polygon, given in either clockwise or counterclockwise order. It is guaranteed that the origin ((0,0)) lies strictly inside the polygon.

outputFormat

Output a single real number: the minimum radius (r) such that the area of intersection between the circle (centered at ((0,0))) of radius (r) and the polygon is at least (S). Your answer is accepted if its absolute or relative error does not exceed (10^{-6}).

sample

4 3
-1 -1
1 -1
1 1
-1 1
1.2870022170