eolymp
bolt
Try our new interface for solving problems
Problems

Mice and holes

Mice and holes

There are $n$ mice and $n$ holes on a straight line. Each hole can only accommodate $1$ mouse. A mouse can stay in its place, move one step to the right from $x$ to $x + 1$, or move one step to the left from $x$ to $x - 1$. Any of these moves takes $1$ minute. Assign mice to holes so that the time when the last mouse hides in a hole is minimized. \InputFile The first line contains the number $n~(n \le 10^5)$. The second line contains the positions of $n$ mice. The third line contains the positions of $n$ holes. The positions of mice and holes are integers from $0$ to $10^9$. \OutputFile Print the minimum time it takes for the last mouse to hide in a hole.
Time limit 1 second
Memory limit 128 MiB
Input example #1
4
3 6 1 9
5 3 11 2
Output example #1
2