Powered Addition
시간 제한1초메모리 제한1024 MB
배열을 비감소로 만들기 위해 각 원소에 2의 거듭제곱을 더하는 최소 초 수를 구한다.
문제
You have an array of length . For every positive integer you are going to perform the following operation during the -th second:
- Select some distinct indices which are between and inclusive, and add to each corresponding position of . Formally, for . Note that you are allowed to not select any indices at all.
You have to make nondecreasing as fast as possible. Find the smallest number such that you can make the array nondecreasing after at most seconds.
Array is nondecreasing if and only if .
You have to answer independent test cases.
입력
The first line contains a single integer () --- the number of test cases.
The first line of each test case contains single integer () --- the length of array . It is guaranteed that the sum of values of over all test cases in the input does not exceed .
The second line of each test case contains integers ().
출력
For each test case, print the minimum number of seconds in which you can make nondecreasing.
힌트
In the first test case, if you select indices at the -st second and at the -nd second, then will become . There are some other possible ways to make nondecreasing in seconds, but you can't do it faster.
In the second test case, is already nondecreasing, so answer is .
In the third test case, if you do nothing at first seconds and select index at the -rd second, will become .