CF1338A.Powered Addition

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 i1,i2,,iki_{1}, i_{2}, \ldots, i_{k} which are between 11 and nn inclusive, and add 2x12^{x-1} to each corresponding position of aa . Formally, aij:=aij+2x1a_{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 a1a2ana_{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 ( 1t1041 \le t \le 10^{4} ) — the number of test cases.

The first line of each test case contains single integer nn ( 1n1051 \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 a1,a2,,ana_{1}, a_{2}, \ldots, a_{n} ( 109ai109-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.

输入输出样例

  • 输入#1

    3
    4
    1 7 6 5
    5
    1 2 3 4 5
    2
    0 -4

    输出#1

    2
    0
    3

说明/提示

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] .

首页