CF702C.Cellular Network
普及/提高-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
给你一条直线上的 n 个点——即城市的坐标(x 坐标),以及同一直线上的 m 个点——即蜂窝基站的坐标(x 坐标)。所有基站工作方式相同:每个基站可为所有与其距离不超过 r 的城市提供蜂窝网络服务。
你的任务是找出最小的 r,使得每个城市均被蜂窝网络覆盖,即:对每个城市,都至少存在一个基站,其与该城市的距离不超过 r。
若 r=0,则基站仅能为其所在位置的那个点提供蜂窝网络服务。一个基站可以同时为任意数量的城市提供服务,但这些城市必须全部位于该基站距离不超过 r 的范围内。
输入格式
The first line contains two 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_1, _a_2, ..., a__n ( - 109 ≤ a__i ≤ 109) — 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 ( - 109 ≤ b__j ≤ 109) — 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.
第一行包含两个正整数 n 和 m(1 ≤ n, m ≤ 105)—— 分别表示城市的数量和蜂窝基站的数量。
第二行包含一个由 n 个整数 a1, a2, ..., an(−109 ≤ ai ≤ 109)组成的序列—— 表示各城市的坐标。允许有任意数量的城市位于同一点。所有坐标 ai 按非递减顺序给出。
第三行包含一个由 m 个整数 b1, b2, ..., bm(−109 ≤ bj ≤ 109)组成的序列—— 表示各蜂窝基站的坐标。允许有任意数量的基站位于同一点。所有坐标 bj 按非递减顺序给出。
输出格式
Print minimal r so that each city will be covered by cellular network.
输出覆盖所有城市的蜂窝网络所需的最小半径 r。
输入输出样例
输入#1
3 2 -2 2 4 -3 0
输出#1
4
输入#2
5 3 1 5 10 14 17 4 11 15
输出#2
3
输入解题思路,AI测评打分。不知道怎么写?