Tarzan Jumps

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

In a forest near Almaty, there are NN trees arranged in a row, numbered from 11 through NN from left to right. Tree number ii has height H_iH\_i

In one jump, Tarzan can move from the top of tree ii to the top of tree jj (i<ji < j) if all the trees between them are either strictly lower or strictly higher than both trees ii and jj. In particular, he can jump from tree ii to tree i+1i + 1. More formally, the jump is possible if at least one of the following conditions holds:

  • j=i+1j = i + 1,
  • for all kk (i<k<ji < k < j): H_i>H_kH\_i > H\_k and H_j>H_kH\_j > H\_k,
  • for all kk (i<k<ji < k < j): H_i<H_kH\_i < H\_k and H_j<H_kH\_j < H\_k.

Tarzan is currently standing on tree 11, and he wants to reach tree NN. Tarzan's ICPC teammate, Abay, can help him. Specifically, he can perform the following change any number of times: choose a number ii (1in1 \le i \le n), an integer xx (0x10180 \le x \le 10^{18}), and set H_i=xH\_i = x.

For each kk from 11 to NN, find the least number of changes that Abay must perform so that Tarzan could get to tree NN in no more than kk jumps.

입력

The first line contains a single integer tt, the number of test cases (1t150,0001 \le t \le 150\\,000). The description of test cases follows.

The first line of each test case contains an integer NN, the number of trees (2N300,0002 \le N \le 300\\,000).

The second line of each test case contains NN integers H_1,H_2,,H_NH\_1, H\_2, \ldots, H\_N (1H_i1091 \le H\_i \le 10^9).

It is guaranteed that the sum of NN over all test cases does not exceed 300,000300\\,000.

출력

For each test case, print NN integers: for each kk from 11 to NN, print the least number of changes that Abay must perform so that Tarzan could get from tree 11 to tree NN in no more than kk jumps.

힌트

In the first test case, for k=1k = 1, Abay can change the height of tree 11 to 33, and Tarzan will be able to jump to the last tree. For k=2k = 2 and k=3k = 3, Tarzan can reach the last tree without any changes.