303633: CF702C. Cellular Network
Memory Limit:256 MB
Time Limit:3 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Cellular Network
题意翻译
在直线上给出n个城市的位置(x坐标)和在同一直线上的m个蜂窝塔的位置(x坐标)。所有的塔都以同样的方式工作——它们为所有城市提供蜂窝网络,这些城市位于离塔不超过r的距离处才能被蜂窝网络覆盖。 你的任务是找出使得每个城市都能被蜂窝网络覆盖的最小r值,即每个城市在距离r的范围内至少有一个蜂窝塔。 如果r=0,则塔仅为其所在的位置提供蜂窝网络。一个塔可以为任意数量的城市提供蜂窝网络,但是所有这些城市都必须在距离塔不超过r的距离上。 输入格式 第一行包含两个正整数n和m,表示有n个城市与m个蜂窝塔。 第二行包含n个整数a[1],a[2]...a[n](a[i]>=a[i-1]),表示每个城市的位置(x坐标) 第三行包含m个整数b[1],b[2]...b[m](b[i]>=b[i-1]),表示每个蜂窝塔的位置(x坐标) 注意,允许多个城市或蜂窝塔位置相同。 输出格式 输出最小的r,使得每个城市都被蜂窝网络覆盖。 数据范围 1<=n,m<=10^5 -10^9<=a[i]<=10^9 -10^9<=b[j]<=10^9题目描述
You are 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 in the same way — they provide cellular network for all cities, which are located at the distance which is no more than $ r $ from this tower. Your task is to find minimal $ r $ that each city has been provided by cellular network, i.e. for each city there is at least one cellular tower at the distance which is no more than $ r $ . If $ r=0 $ then a tower provides cellular network only for the point where it is located. One tower can provide cellular network for any number of cities, but all these cities must be at the distance which is no more than $ r $ from this tower.输入输出格式
输入格式
The first line contains two positive integers $ n $ and $ m $ ( $ 1<=n,m<=10^{5} $ ) — the number of cities and the number of cellular towers. The second line contains a sequence of $ n $ integers $ a_{1},a_{2},...,a_{n} $ ( $ -10^{9}<=a_{i}<=10^{9} $ ) — the coordinates of cities. It is allowed that there are any number of cities in the same point. All coordinates $ a_{i} $ are given in non-decreasing order. The third line contains a sequence of $ m $ integers $ b_{1},b_{2},...,b_{m} $ ( $ -10^{9}<=b_{j}<=10^{9} $ ) — the coordinates of cellular towers. It is allowed that there are any number of towers in the same point. All coordinates $ b_{j} $ are given in non-decreasing order.
输出格式
Print minimal $ r $ so that each city will be covered by cellular network.
输入输出样例
输入样例 #1
3 2
-2 2 4
-3 0
输出样例 #1
4
输入样例 #2
5 3
1 5 10 14 17
4 11 15
输出样例 #2
3