#BS0000331. Bò nổi giận – Gold (Angry Cows (Gold))
Bài tập thuộc lộ trình
Mục lục đề ⌄
Bò nổi giận – Gold (Angry Cows (Gold))
Angry Cows (Gold)
Source: USACO
Version: Phuoc Hung OJ Extended
Problem Statement
In this version of Bessie's game, bales lie at distinct integer coordinates on a line. The player may launch only one cow, choosing a real landing coordinate and nonnegative real power .
The initial blast destroys every bale at distance at most from . In the next round, all newly destroyed bales explode simultaneously with radius . An intact bale within any of these blasts is destroyed in that round. Subsequent rounds decrease the radius by one, with only newly destroyed bales generating the next blasts. Negative radii destroy no additional bales.
Choose a landing point and the smallest power that destroys all bales.
Input
The first line contains integer , the number of bales.
Each of the following lines contains one integer , the coordinate of bale .
Output
Print the minimum power , rounded and formatted with exactly one digit after the decimal point.
Subtasks
- Subtask 1 (20 points): ; ; for .
- Subtask 2 (30 points): ; ; for ; sorted coordinates form an arithmetic progression.
- Subtask 3 (50 points): ; ; for .
Examples
Input 1
5
8
10
3
11
1
Output 1
3.0
Explanation
Launch at 5 with : the initial blast destroys 3 and 8, radius 2 destroys 1 and 10, and radius 1 destroys 11. If , later radii are less than 2 and cannot cross the gaps from 1 to 3 or from 8 to 10. The initial blast would have to reach 1 and at least one of 10 and 11, requiring diameter at least 9, contrary to . Thus 3 is optimal.
Input 2
2
0
3
Output 2
1.5
Explanation
Launch at 1.5 with radius 1.5 to hit both bales. A smaller initial radius cannot hit both, and the next radius would be less than 0.5, unable to cross their gap of 3.