Maximize the Minimum
시간 제한4초메모리 제한2048 MB
예산 안에서 원소 일부를 제거한 뒤 남은 a와 b 사이 최소 절댓값 차이를 최대한 크게 만드는 값을 구한다.
문제
You have an array of length and an array of length . You can choose to remove some elements from the arrays. Removing element costs coins, and removing element costs coins. Importantly, there should be at least one element left in and at least one left in .
When you are done removing the elements, you compute the following value:
You want to maximize this value. What is the maximum value you can get if you can spend at most coins in total?
입력
The first line contains an integer (), the number of test cases. The test cases follow.
The first line of each test case contains integers (), () and (). The next four lines contain integer arrays , , , , in this order (; ). The arrays and have length . The arrays and have length .
The sum of over all test cases does not exceed . The sum of over all test cases does not exceed .
출력
For each test case, print the maximum possible value you can get.