/*** Minimum last element of the ascending subsequence with the storage length of P [I] X can be introduced. The element divisions in P [I] are arranged in ascending order, * Because a sequence with the length of I can be found in the sequence with the length of I-1, the last element of the sequence with the length of I-1 must be smaller than the last element of the sequence with the length of I, ascending subsequence? * If P [I-1] is larger than P [I], the last element of the sequence whose length is I-1 above can update it * if the current element is largest, the length is increased. * Otherwise, you can find a new one, find the maximum number of lines that can be left * in the order of one side, and find the length of the longest ascending subsequence. Common methods may time out, So binary */# include <stdio. h> int d [40010], p [40010], L; int main () {int t, n, I, STA, end, mid; scanf ("% d ", & T); While (t --) {scanf ("% d", & N); for (I = 1; I <= N; I ++) scanf ("% d", & D [I]); P [1] = d [1]; L = 1; for (I = 2; I <= N; I ++) {sta = 1; end = L + 1; while (STA <End) {mid = (STA + end)/2; if (d [I] <= P [Mid]) End = mid; elsesta = Mid + 1;} p [end] = d [I]; if (END = L + 1) l ++;} printf ("% d \ n", L);} return 0 ;}