Balkan OI '11 P1 - Two Circles

View as PDF

Submit solution


Points: 30 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type
Balkan Olympiad in Informatics: 2011 Day 1, Problem 1

We will consider a convex polygon with N vertices. We wish to find the maximum radius R such that two circles of radius R can be placed entirely inside the polygon without overlapping.

Input Specification

The first line of input contains the number N. Each of the next N lines contains a pair of integers xi, yi – representing the coordinates of the ith point, separated by a space.

Output Specification

You should output a single number R – the desired radius. Output R with a precision of 3 decimals. You will pass a test if the output differs from the true answer by at most 0.001.

Constraints

  • 3N50000
  • 107xi107
  • 107yi107
  • The points are given in trigonometric (anti-clockwise) order.
  • For 10% of tests N=3
  • For 40% of tests N250

Sample Input 1

Copy
4
0 0
1 0
1 1
0 1

Sample Output 1

Copy
0.293

Explanation for Sample Output 1

The maximum radius is obtained when the centers of the two circles are placed on one of the square's diagonals. The radius can be calculated exactly and it is 22(1+2)0.293

Sample Input 2

Copy
4
0 0
3 0
3 1
0 1

Sample Output 2

Copy
0.500

Sample Input 3

Copy
6
0 0
8 0
8 6
4 8
2 8
0 4

Sample Output 3

Copy
2.189

Comments

There are no comments at the moment.