Subsequence

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

문제

A nondecreasing subsequence (b_1,b_2,,b_k)(b\_1, b\_2, \ldots, b\_k) of a sequence (a_1,a_2,,a_n)(a\_1, a\_2, \ldots, a\_n) is said to be a maximal nondecreasing subsequence of aa if there is no nondecreasing subsequence (c_1,c_2,,c_l)(c\_1, c\_2, \ldots, c\_l) of aa such that bb is a subsequence of cc and k<lk < l.

Given the sequence (a_1,a_2,,a_n)(a\_1, a\_2, \ldots, a\_n), find the length of its shortest maximal nondecreasing subsequence.

입력

The first line of input contains the number of test cases TT. The descriptions of the test cases follow.

The description of each test case starts with a line containing one integer nn (1n1061 \le n \le 10^6). The second line contains nn  integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (0a_i1090 \le a\_i \le 10^9).

출력

For each test case, print one integer: the length of the shortest maximal nondecreasing subsequence of the given sequence aa.