Cover the Polygon with Your Disk
Time limit3sMemory limit512 MB
Place a fixed-radius disk anywhere on the plane to maximize the area shared with a convex polygon, and print that maximum.
- Level
Hard8 of 10
- Topics
- Geometry, Binary search, Implementation
- Solved
- No attempts yet
Problem
A convex polygon is drawn on a flat sheet of paper. You put a disk of radius on the paper so that the area shared by the polygon and the disk is as large as possible. The center of the disk can go anywhere on the paper, and its coordinates do not have to be integers.
Compute that largest shared area.
Input
The input is one test case in the following format. Every value in the input is an integer.
n r
x1 y1
.
.
.
xn yn
is the number of vertices of the polygon, with . is the radius of the disk, with . and are the coordinates of the -th vertex, with and .
The vertices are given in counterclockwise order. The polygon is convex, so every interior angle is smaller than and the boundary never crosses or touches itself.
Output
Print the largest shared area on one line, rounded to four digits after the decimal point. Always print exactly four digits after the decimal point, even when they are zeros. For an answer of , print 0.5000.