Rafting Design
Time limit1sMemory limit128 MB
Given an inner polygon fully enclosed by an outer polygon, compute the maximum radius of a circle that can travel all the way around the annular track between them without getting stuck.
- Level
Hard8 of 10
- Topics
- Geometry, Binary search, Graph
- Solved
- No attempts yet
Problem
Heehyun, the designer of a new rafting project, drew two polygons so that the outer polygon completely contains the inner one, then turned the empty space between them into a rafting track.
Now the size of the circular tube that will float along the track must be decided. The tube has to move and rotate freely all the way around the track, so it must not get stuck anywhere. Heehyun wants the tube to be as large as possible, but if it is too large it will jam in a narrow part of the track.
Find the maximum radius of a circular tube that can travel freely all the way around the track (the region between the two polygons).
Input
The first line contains the number of test cases ().
Each test case is given as follows.
- The first line contains the number of vertices of the inner polygon (), followed by lines, each containing the coordinates of a vertex given in order along the polygon.
- The next line contains the number of vertices of the outer polygon (), followed by lines, each containing the coordinates of a vertex given in order.
All coordinates are integers with absolute value at most . The vertices of each polygon are given in clockwise or counterclockwise order. The two polygons neither overlap nor touch, and the outer polygon always completely contains the inner one.
Output
For each test case, print the maximum radius of a circular tube that can move freely around the track, rounded to exactly six digits after the decimal point, one per line.