#P7249. Farthest Minimum Distance on a Segment

    ID: 20450 Type: Default 1000ms 256MiB

Farthest Minimum Distance on a Segment

Farthest Minimum Distance on a Segment

Given a line segment from 0 to L and N points on this segment, find the maximum distance from any point on the segment to its nearest given point.

In other words, for any x \( \in [0,L] \), let \[ f(x)=\min_{1\le i\le N} |x-p_i|, \] where \(p_1, p_2, \ldots, p_N\) are the positions of the given points. You are required to compute \[ \max_{x\in[0,L]} f(x). \]

This maximum distance is achieved at either one of the endpoints or at the midpoint between two consecutive points when the given points are sorted in increasing order.

inputFormat

The first line of input contains two integers L and N, where L (L ≥ 0) is the length of the segment (with the segment being [0,L]), and N is the number of given points.

The second line contains N space-separated integers, each indicating the position of a point on the segment. It is guaranteed that all points lie in the interval [0, L].

outputFormat

Output a single number representing the maximum distance from any point on the segment to its closest given point. The answer could be a floating-point number and should be printed with one decimal place.

sample

10 2
0 10
5.0