#t388. 最长下降子序列
最长下降子序列
Hang Gliding
Problem Description
A glider's hang-glider power unit is broken, so he can only glide downward — that is, he can only glide from a higher building to a lower building.
There are buildings in the city arranged in a straight line, and every building has a distinct height. Initially, he may choose the top of any building as his starting point and choose a direction to escape, but he cannot change direction during the process. He hopes to pass over as many different building tops as possible while descending, so as to reduce the impact of landing.
What is the maximum number of different building tops he can pass over (including the starting building)?
Input Format
The first line of input is an integer (), the number of test data groups.
Each data group contains two lines: the first line is an integer (), the number of buildings; the second line contains distinct integers, giving the heights of the buildings in their arrangement order ().
Output Format
For each data group, output one line with one integer: the maximum number of buildings he can pass over.
Sample Input 1
3
8
300 207 155 299 298 170 158 65
8
65 158 170 298 299 155 207 300
10
2 1 3 4 5 6 7 8 9 10
Sample Output 1
6
6
9