#B4242. Minimum Signal Radius
Minimum Signal Radius
Minimum Signal Radius
There are \(n\) cities labeled from \(1\) to \(n\) and \(m\) signal towers labeled from \(1\) to \(m\) placed on a straight line. Assume we set a point on the line as the origin \(0\); then the cities have positions \(a_1, a_2, \dots, a_n\) and the towers have positions \(b_1, b_2, \dots, b_m\). Each signal tower can provide network coverage to any city within a distance \(r\) (i.e. a city \(a_i\) is covered if \(|a_i-b_j|\le r\) for some tower \(b_j\)).
Your task is to determine the minimum \(r\) such that every city is covered by at least one signal tower.
inputFormat
The first line contains two integers \(n\) and \(m\) representing the number of cities and towers, respectively.
The second line contains \(n\) integers \(a_1, a_2, \dots, a_n\) indicating the coordinates of the cities.
The third line contains \(m\) integers \(b_1, b_2, \dots, b_m\) indicating the coordinates of the towers.
outputFormat
Output a single integer which is the minimum \(r\) required so that every city is within distance \(r\) of at least one signal tower.
sample
3 2
1 5 10
4 9
3
</p>