1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 5 int ans; 6 int v[21]; 7 8 void solve(int x) 9 { 10 int t; 11 if(!ans || v[ans] > x) 12 v[++ans] = x; 13 else 14 { 15 for(t=ans; t>0; --t) 16 if(v[t] > x && v[t+1] < x) 17 { 18 v[t+1] = x; 19 break; 20 } 21 if(!t) 22 v[1] = x; 23 } 24 } 25 26 int main() 27 { 28 int n,m,x; 29 cin >> n; 30 while(n--) 31 { 32 memset(v,0,sizeof v); 33 ans = 0; 34 cin >> m; 35 while(m--) 36 { 37 cin >> x; 38 solve(x); 39 } 40 cout << ans << endl; 41 } 42 }