


1. If the ith building has a height greater than or equal to the next i.e (i+1)th building then he simply jumps to the next building.
2. Otherwise he uses either {‘HEIGHTS[i+1] -‘HEIGHTS[i]} bricks or just 1 ladder to climb up to the next building.
The first line of input contains an integer ‘T’ denoting the number of test cases. Then each test case follows.
The first line of each test case contains three integers ‘N’, ‘BRICKS’ and ‘LADDERS’ denoting the number of buildings, number of bricks, and number of ladders respectively.
The second line contains ‘N’ space-separated distinct integers where the ith integer denotes the height of the ith building.
For each test case, print a single line containing a single integer, denoting the maximum index of the building chef can travel up to using the bricks and ladders optimally.
The output of every test case will be printed in a separate line.
You don’t have to print anything, it has already been taken care of. Just implement the given function.
1 <= T <=10
2 <= N <= 10 ^ 5
1 <= HEIGHTS[i] <= 10 ^ 6
0 <= ‘BRICKS’<= 10 ^ 4
0 <=’LADDERS’ < N
Where ‘T’ denotes the number of test cases, ‘N’ denotes the size of ‘HEIGHTS’ and ‘HEIGHT[i]’ denotes the height of the ith building, ‘BRICKS’ denotes the number of bricks and ‘LADDERS’ denote the number of ladders.
Time limit: 1 second
Complete Algorithm :
In the previous approach we were calculating the ‘store’ multiset every time from index 1 to ‘idx’ though we just needed to find the correct location of the current increment(if any) amongst the previous increments encountered. More formally, we need to find a way to insert a value in an already sorted array, and then check if this new value is one of the max ‘ladder’ values or not.