You is given n points on the straight line-the positions (x-coordinates) of the cities and m points on the same line-the positions ( x-coordinates) of the cellular towers. All towers work on the same way-they provide cellular network for all cities, which be located at the distance which is No more than R from the This tower.
Your task is to find minimal R , all city have been provided by cellular network, i.e. for each city there is at least one cellular tower at the distance which are no more than R.
If R=?0 then a-tower provides cellular network only in the where it is located. One tower can provide cellular network for any number of cities, but all these cities must are at the distance which are no More than R from the This tower.
Input
The first line contains the positive integers n and m (1?≤? N,? M.≤?105)-the number of cities and the number of cellular towers.
The second line contains a sequence of n integers a Sub class= "Lower-index" >1 ,? a 2 ,?...,? a n (?-? 109 ? ≤? a i ? ≤?109 )-the coordinates of cities. It is allowed, that there was any number of cities in the same point. All coordinates a i is given in non-decreasing order.
The third line contains a sequence of m integers b1,? b2,?...,? bm (?-?9? ≤? bJ. ≤?109)-the coordinates of cellular towers. It is allowed, that there was any number of towers in the same point. All coordinates bJ is given in non-decreasing order.
Output
Print minimal R So, each city would be covered by cellular network.
Example
Input
3 2
-2 2 4
-3 0
Output
4
Input
5 3
1 5 10) 14 17
4 11 15
Output
3
Greedy, two points can be, the following is greedy practice.
#include <iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespacestd;inta,b,maxx=0, S;Long Longaa[100005],bb[100005];intSuanLong Longx) { while(x>bb[s+1]&&s<b) S++; returnMin (bb[s+1]-x,abs (xBb[s]));}intMain () {scanf ("%d%d",&a,&b); for(intI=0; i<a;i++) scanf ("%lld",&Aa[i]); for(intI=0; i<b;i++) scanf ("%lld",&Bb[i]); BB[B]=1e18+1; S=0; for(intI=0; i<a;i++) Maxx=Max (Maxx,suan (aa[i)); printf ("%d\n", Maxx); return 0;}
codeforces-702c Cellular Network