


Two or more workers may split simultaneously so that the cost would be ‘SPLIT’ at that time.
The first line contains an integer ‘T’, which denotes the number of test cases to be run. Then, the T test cases follow.
The first line of each test case contains two positive integers, ‘N’, and ‘SPLIT’, denote the total number of blocks and the time required to split a worker.
The second line of each test case contains ‘N’ positive integers, where ith integer represents the time required to build the ith block.
For each test case, print the “minimum time” required to build all the blocks.
Output for each test case will be printed in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^4
1 <= ‘SPLIT’ <= 100
1 <= ‘BLOCK[i]’ <= 10^4
Time Limit: 1sec
Let us try to visualize this by using an example, ‘BLOCK’ = [1, 2, 4, 5] , ‘SPLIT’ = 4.
Step 1: Min-heap at this step = [1, 2, 4, 5].
Step 2: Min-heap at this step = [ 4, 5, 6].
Step 3: Min-heap at this step = [6, 9].
Step 4: Min-heap at this step = [13], i,e., the size is ‘1’ so we return the top element.
So, the total cost to build all blocks would be ‘13’.