← Home
write a go solution for F. Towering Arraystime limit per test6 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard output An array b=[b_1,b_2,ldots,b_m] of length m is called p-towering if there exists an index i (1<=i<=m) such that for every index j (1<=j<=m), the following condition holds: b_j \ge p - |i - j|.Given an array a=[a_1,a_2,ldots,a_n] of length n, you can remove at most k elements from it. Determine the maximum value of p for which the remaining array can be made p-towering.InputEach test contains multiple test cases. The first line contains the number of test cases t (1<=t<=10^4). The description of the test cases follows. The first line of each test case contains two integers n and k (0<=k<n<=2*10^5).The second line contains n integers a_1,a_2,ldots,a_n (1<=a_i<=10^9).It is guaranteed that the sum of n over all test cases does not exceed 2*10^5. OutputFor each test case, output a single integer — the maximum value of p for which the remaining array can be made p-towering.ExampleInput65 02 1 4 5 25 32 1 4 5 26 11 2 3 4 5 111 66 3 8 5 8 3 2 1 2 7 114 33 2 3 5 5 2 6 7 4 8 10 1 8 92 01 1Output3
5
5
7
9
1
NoteIn the first test case, you cannot delete any element. The array remains [2,1,4,colorred5,2] and is p-towering for p=3 by picking i=4:  a_1=2>=p-|i-1|=3-|4-1|=0;  a_2=1>=p-|i-2|=3-|4-2|=1;  a_3=4>=p-|i-3|=3-|4-3|=2;  a_4=5>=p-|i-4|=3-|4-4|=3;  a_5=2>=p-|i-5|=3-|4-5|=2. In the second test case, you can remove the first, second, and fifth elements to obtain the array [4,colorred5]. Clearly, the obtained array is p-towering for p=5 by picking i=2.. Output only the code with no comments, explanation, or additional text.