题目描述:
You are given two sequences: A=(A1,A2,…,AN) consisting of N positive integers, and B=(B1,…,BM) consisting of M positive integers.
Find the minimum difference of an element of A and an element of B, that is, min1≤i≤Nmin1≤j≤M|Ai−Bj|.
数据范围:
-
1≤N,M≤2×10^5
-
1≤Ai≤10^9
-
1≤Bi≤10^9
-
All values in input are integers.
输入:
Input is given from Standard Input in the following format:
N M
A1 A2 …… AN
B1 B2 …… BM
输出:
Print the answer.
样例输入1:
2 2
1 6
4 9
样例输出1:
2
Here is the difference for each of the four pair of an element of A and an element of B: |1−4|=3, |1−9|=8, |6−4|=2, and |6−9|=3. We should print the minimum of the