#P1987C. Basil's Garden
Basil's Garden
Description
There are flowers in a row, the -th of them initially has a positive height of meters.
Every second, the wind will blow from the left, causing the height of some flowers to decrease.
Specifically, every second, for each from to , in this order, the following happens:
- If or , the value of changes to .
How many seconds will pass before for all for the first time?
Each test contains multiple test cases. The first line of input contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer () — the number of flowers.
The second line of each test case contains integers () — the heights of the flowers.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output a single integer — the number of seconds that will pass before for all .
Input
Each test contains multiple test cases. The first line of input contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer () — the number of flowers.
The second line of each test case contains integers () — the heights of the flowers.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output a single integer — the number of seconds that will pass before for all .
Note
In the first test case, the flower heights change as follows: .
In the second test case, the flower heights change as follows: .