#BS0000056. Mạng di động (Cellular Network)
Mạng di động (Cellular Network)
Cellular Network
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are cities and cellular towers on a straight line. Their coordinates are and .
A tower at covers a city at when
All towers use the same integer coverage radius . Find the minimum such that every city is covered by at least one tower.
Input
- The first line contains integers .
- The second line contains city coordinates in non-decreasing order.
- The third line contains tower coordinates in non-decreasing order.
Output
Print the minimum required radius .
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , . Duplicate coordinates are allowed.
Example
Input
3 2
-2 2 4
-3 0
Output
4
Explanation
The nearest-tower distances for cities are . Hence every radius below fails for the city at , while covers all cities.