#P1633D. Make Them Equal
Make Them Equal
No submission language available for this problem.
Description
You have an array of integers of size . Initially, all elements of the array are equal to . You can perform the following operation: choose two integers () and (), and then increase the value of by (i.e. make ).
After performing all operations, you will receive coins for all such that .
Your task is to determine the maximum number of coins that you can receive by performing no more than operations.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and () — the size of the array and the maximum number of operations, respectively.
The second line contains integers ().
The third line contains integers ().
The sum of over all test cases does not exceed .
For each test case, print one integer — the maximum number of coins that you can get by performing no more than operations.
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and () — the size of the array and the maximum number of operations, respectively.
The second line contains integers ().
The third line contains integers ().
The sum of over all test cases does not exceed .
Output
For each test case, print one integer — the maximum number of coins that you can get by performing no more than operations.