Gửi bài giải
Điểm:
2,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Given the height of N men and M women. We need to form X pairs of one man and one woman. H is the maximum height difference of a pair, H = max({|pair.manHeight – pair.womanHeight| for X pairs}). What is the minimum possible value of H?
Input
The first line contains three integers N, M, X (1 ≤ N ≤ ~10^{5}~).
The second line contains N integers indicating the height of N men.
The third line contains M integers indicating the height of M women.
Output
The minimum possible value of H.
Note: 50% test case: X = N = M
Sample Input
5 6 3
150 180 165 184 156
152 168 175 159 168 190
Sample Output
3
Sample Input
5 5 5
150 180 165 184 156
152 168 175 159 168
Sample Output
12
Bình luận