An integer sequence is a pyramid if it satisfies the following conditions:
For example, is a pyramid, but and are not.
An integer sequence is good if it is possible to make it a pyramid by performing the following operation any number of times:
The cost of a good sequence is the minimum number of times you have to perform the above operation to make it good.
You are given an integer sequence . You have to find the maximum length of a subarray which is good and among all such subarrays, you have to find the one with the minimum cost.
The subarray of an array with length
$n$ is a contiguous part of the array, i. e. the sequence for some .
The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer .
The second line contains space-separated integers .
The sum of over all test cases does not exceed .
For each test case, print two space-separated integers — the maximum length of a good subarray and the minimum cost of all good subarrays with the maximum length.
4 5 1 1 5 2 3 4 1 4 2 1 3 1 2 1 10 1 4 4 2 3 5 6 4 2 1
3 4 3 3 3 0 7 7
Login to submit