PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000331. Bò nổi giận – Gold (Angry Cows (Gold))

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

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, nn bales lie at distinct integer coordinates xix_i on a line. The player may launch only one cow, choosing a real landing coordinate pp and nonnegative real power RR.

The initial blast destroys every bale at distance at most RR from pp. In the next round, all newly destroyed bales explode simultaneously with radius R−1R-1. 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 RR that destroys all bales.

Input

The first line contains integer nn, the number of bales.

Each of the following nn lines contains one integer xix_i, the coordinate of bale ii.

Output

Print the minimum power RR, rounded and formatted with exactly one digit after the decimal point.

Subtasks

  • Subtask 1 (20 points): 2≤n≤102\le n\le10; 0≤xi≤240\le x_i\le24; xi≠xjx_i\ne x_j for i≠ji\ne j.
  • Subtask 2 (30 points): 2≤n≤500002\le n\le50000; 0≤xi≤1090\le x_i\le10^9; xi≠xjx_i\ne x_j for i≠ji\ne j; sorted coordinates form an arithmetic progression.
  • Subtask 3 (50 points): 2≤n≤500002\le n\le50000; 0≤xi≤1090\le x_i\le10^9; xi≠xjx_i\ne x_j for i≠ji\ne j.

Examples

Input 1

5
8
10
3
11
1

Output 1

3.0

Explanation

Launch at 5 with R=3R=3: the initial blast destroys 3 and 8, radius 2 destroys 1 and 10, and radius 1 destroys 11. If R<3R<3, 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 2R<62R<6. 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.