#P10679. Maximum α in the Spectrum
Maximum α in the Spectrum
Maximum α in the Spectrum
Given a real number (\alpha), its spectrum (\operatorname{Spec}(\alpha)) is defined as an infinite sequence
[ \lceil \alpha \rceil - 1,; \lceil 2\alpha \rceil - 1,; \lceil 3\alpha \rceil - 1,; \ldots ]
For example, the beginning of the spectrum for (\alpha = \frac{3}{5}) is
[0,; 1,; 1,; 2,; 2,; 3,; 4, \ldots]
Now, you are given (n) integers (x_1,x_2,\ldots,x_n). Your task is to find the largest real number (\alpha) such that for every (x_i) there exists an index (j\ge 1) satisfying
[ \lceil j\alpha \rceil - 1 = x_i. \quad\text{(i.e. } x_i < j\alpha \le x_i+1\text{)} ]
More precisely, for each given (x), there must exist a positive integer (j) such that
[ x < j\alpha \le x+1. ]
It can be shown that the condition for a fixed (x) is equivalent to saying that if we let (j = \lfloor x/\alpha \rfloor + 1), then the inequality
[ j\alpha \le x+1 ]
must hold. The function is monotonic in (\alpha) (when (\alpha) is too high, some (x_i) will fail the condition) so that a binary search may be used to determine the maximum (\alpha) which works for all (x_i).
inputFormat
The input begins with a line containing an integer (n) ((1 \le n \le 10^5)), representing the number of required integers. The next line contains (n) space-separated non-negative integers (x_1, x_2, \ldots, x_n).
outputFormat
Output the maximum real number (\alpha) that satisfies the condition for all given integers. Print (\alpha) with at least 10 decimal places of precision.
sample
1
0
1.0000000000
</p>