Original title link Luogu link
Have nnn trampolines are arranged in a row, and each trampoline has an elasticity valuesi s_isi
At the very beginning of each round, Pekora will choose a trampoline as her starting point (any trampoline can be used as a starting point). When she was on the trampoline iiWhen i , she will jump to the trampolinei + si i+s_ii+siOn, and si s_isiWill become max (1, si − 1) max(1,s_i-1)max(1,si−1 ) (That is, the elasticity value of the trampoline will be reduced by one every time the trampoline is jumped, until the elasticity value is1 11 ). When she jumped tonnWhen n trampolines are behind, the round ends.
Now, Pekora wants to put all the si s_isiAll become 1 11. Ask the minimum number of rounds to achieve this goal
Input format
There are multiple sets of data in this question
An integer TT in the first lineT , indicates the number
of groups of data For each group of data:
an integernn in thefirst linen , said the number of trampolines, the
second linennn integers,s 1… n s_{1\dots n}s1…n
Output format
Total TTT line, each line an integer represents the answer to the group of data
Instructions and tips
1 ≤ T ≤ 500 1 \ le T \ le 500 1≤T≤5 0 0
∑ n ≤ 5000 \ sum n \ le 5000∑n≤5 0 0 0
1 ≤ si ≤ 1 0 9 1 \ le s_i \ le 10 ^ 91≤si≤109