Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/qidiruv-isitgichlar

Heater radius

Medium 1000 ms 128 MB 53%
Share

On a straight street there are $n$ houses and $m$ heaters; the $i$-th house is at point $a_{i}$, the $j$-th heater is at point $b_{j}$ (several houses or heaters may stand at one point). All heaters work with the same radius $R$: a heater warms the houses that are at most $R$ away from it. Find the smallest integer $R$ at which every house is warmed.

Houses and heaters on the number line; the distance from each house to the nearest heater, the largest one highlighted

Input

The first line contains two positive integers: $n$ and $m$.
The second line contains $n$ integers $a_{i}$.
The third line contains $m$ integers $b_{j}$.

Output

One integer — the smallest $R$.

Note

$1 \le n, m \le 10^{5}$
$-10^{9} \le a_{i}, b_{j} \le 10^{9}$

Examples

Input #1
4 2
1 2 3 9
2 7
Output #1
2
Input #2
3 1
5 5 5
5
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.