这是要点思维的签到模拟题
Traffic
Problem Description
Avin is observing the cars at a crossroads. He finds that there are n cars running in the east-west direction with the i-th car passing the intersection at time ai . There are another m cars running in the north-south direction with the i-th car passing the intersection at time bi . If two cars passing the intersections at the same time, a traffic crash occurs. In order to achieve world peace and harmony, all the cars running in the north-south direction wait the same amount of integral time so that no two cars bump. You are asked the minimum waiting time.
Input
The first line contains two integers $n$ and $m (1 \leq n, m \leq 1, 000)$. The second line contains $n$ distinct integers $a_i (1 \leq ai \leq 1, 000)$. The third line contains $m$ distinct integers $b_i (1 \leq b_i \leq 1, 000)$.
Output
Print a non-negative integer denoting the minimum waiting time.
Sample Input
1 1
1
1
1 2
2
1 3
Sample Output
1
0
The Code Of My Program
1 | /********************* |