#BS0000395. Khu bảo tồn thiên nhiên (Nature Reserve)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Khu bảo tồn thiên nhiên (Nature Reserve)
Nature Reserve
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Model a forest as a coordinate plane. There are rare animals, with animal living at . A circular reserve, including its interior and boundary, must cover all dwellings.
The river follows . The reserve must touch the river so animals can drink, but may not cross it because boats must pass. Thus the closed disk and the line must have exactly one common point.
Find the minimum radius satisfying these requirements, or determine that no reserve is possible.
Input
The first line contains the integer , the number of dwellings.
Each of the following lines contains two integers , the coordinates of dwelling .
Output
Print -1 if no reserve exists. Otherwise print one real number, the minimum radius. For a submitted value and correct value , the allowed error is .
Subtasks
- Subtask 1 (20 points): ; and for every ; all coordinate pairs are distinct.
- Subtask 2 (30 points): ; and for every ; all coordinate pairs are distinct.
- Subtask 3 (50 points): ; and for every ; all coordinate pairs are distinct.
Examples
Input
1
0 1
Output
0.5
Explanation
The point is one unit from the river. The diameter must be at least one. Center and radius attain the bound.
Input
3
0 1
0 2
0 -3
Output
-1
Explanation
Two points are above the river and the third is below. A tangent disk lies on one side, so it cannot cover all three.
Input
2
0 1
1 1
Output
0.625
Explanation
The center is symmetric between the points. Squared distance to either is . At least one horizontal offset is at least for any center, so , giving . The center attains the bound.