题目描述
Pushpa has entered Chefland and wants to establish Pushpa-Raj here too.
Chefland has N towers where the height of the i^{th} tower is H_{i}. To establish Pushpa-Raj, Pushpa does the following:
Initially, Pushpa chooses any tower i (1≤ i ≤ N) and lands on the roof of that tower.
Let X denote the height of the tower Pushpa is currently on, then, Pushpa can land on the roof of any tower j (1≤ j ≤ N) such that the height of the j^{th} tower is (X+1).
Let i denote the index of the tower on which Pushpa lands, then, the height of all towers except tower i increases by 1 after each jump including the initial jump.
To establish Pushpa-Raj, Pushpa wants to land at the maximum height possible. Determine the maximum height Pushpa can reach.
------ Input Format ------
- The first line contains a single integer T - the number of test cases. Then the test cases follow.
- The first line of each test case contains an integer N - the number of towers
- The second line of each test case contains $N space-separated integers H_{1}, H_{2}, \dots, H_{N}$ denoting the initial heights of each of the towers from the ground.
------ Output Format ------
For each test case, output in a single line the maximum height achieved by Pushpa.
------ Constraints ------
$1 ≤ T ≤ 10$
$1 ≤ N ≤ 10^{5}$
$1 ≤ H_{i} ≤ 10^{9}$
----- Sample Input 1 ------
2
4
1 2 1 3
1
2
----- Sample Output 1 ------
3
2
----- explanation 1 ------
- Test case $1$: If Pushpa chooses to start from tower at index $1$ with height of $1$ unit, then, the new heights will be $[ 1, 3, 2, 4 ]$. He can then jump to the $3^{rd}$ tower (with height $2$ units). The updated heights of the towers is $[2, 4, 2, 5]$. Pushpa is unable to make any more jumps.
The optimal way to in this case is to take an initial jump at tower $4$ with height $3$. The maximum height Pushpa can reach is $3$.
- Test case $2$: There is only $1$ tower so Pushpa reaches the maximum height of $2$ units.
输入格式
见题面
输出格式
见题面