아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Powered Addition

시간 제한1초메모리 제한1024 MB

요약
배열을 비감소로 만들기 위해 각 원소에 2의 거듭제곱을 더하는 최소 초 수를 구한다.
난이도

보통10점 중 6점

유형
그리디, 비트 연산, 수학
정답자
아직 제출이 없습니다

문제

You have an array aa of length nn. For every positive integer xx you are going to perform the following operation during the xx-th second:

  • Select some distinct indices i_1,i_2,…,i_ki\_{1}, i\_{2}, \ldots, i\_{k} which are between 11 and nn inclusive, and add 2x−12^{x-1} to each corresponding position of aa. Formally, a_i_j:=a_i_j+2x−1a\_{i\_{j}} := a\_{i\_{j}} + 2^{x-1} for j=1,2,…,kj = 1, 2, \ldots, k. Note that you are allowed to not select any indices at all.

You have to make aa nondecreasing as fast as possible. Find the smallest number TT such that you can make the array nondecreasing after at most TT seconds.

Array aa is nondecreasing if and only if a_1≤a_2≤…≤a_na\_{1} \le a\_{2} \le \ldots \le a\_{n}.

You have to answer tt independent test cases.

입력

The first line contains a single integer tt (1≤t≤1041 \le t \le 10^{4}) --- the number of test cases.

The first line of each test case contains single integer nn (1≤n≤1051 \le n \le 10^{5}) --- the length of array aa. It is guaranteed that the sum of values of nn over all test cases in the input does not exceed 10510^{5}.

The second line of each test case contains nn integers a_1,a_2,…,a_na\_{1}, a\_{2}, \ldots, a\_{n} (−109≤a_i≤109-10^{9} \le a\_{i} \le 10^{9}).

출력

For each test case, print the minimum number of seconds in which you can make aa nondecreasing.

힌트

In the first test case, if you select indices 3,43, 4 at the 11-st second and 44 at the 22-nd second, then aa will become \[1,7,7,8]\[1, 7, 7, 8]. There are some other possible ways to make aa nondecreasing in 22 seconds, but you can't do it faster.

In the second test case, aa is already nondecreasing, so answer is 00.

In the third test case, if you do nothing at first 22 seconds and select index 22 at the 33-rd second, aa will become \[0,0]\[0, 0].

예제1

  1. 예제 1

    입력
    3
    4
    1 7 6 5
    5
    1 2 3 4 5
    2
    0 -4
    
    예상 출력
    2
    0
    3