A10524 | Cellular Network
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted