Submit | All submissions | Best solutions | Back to list |
EI2122Q1ADAM2 - Matching |
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 ≤ 105).
- 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 |
Output |
5 6 3 150 180 165 184 156 152 168 175 159 168 190 |
3 |
5 5 5 150 180 165 184 156 152 168 175 159 168 |
12 |
Added by: | Ha Minh Ngoc |
Date: | 2021-11-15 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |