#include
<
iostream
>
using
namespace
std;
int
t;
int
n,a;
int
size;
int
c[
40001
];
int
cal(
int
ai){
int
l
=
0
,r
=
size
-
1
;
while
(l
<=
r){
int
mid
=
(l
+
r)
>>
1
;
if
(a
>
c[mid
-
1
]
&&
a
<=
c[mid])
return
mid;
else
if
(a
>
c[mid]) l
=
mid
+
1
;
else
r
=
mid
-
1
;
}
}
int
main()
{
scanf(
"
%d
"
,
&
t);
while
(t
--
){
scanf(
"
%d%d
"
,
&
n,
&
a); n
--
;
c[
0
]
=
a; size
=
1
;
while
(n
--
){
scanf(
"
%d
"
,
&
a);
int
j;
if
(a
<=
c[
0
]) j
=
0
;
else
if
(a
>
c[size
-
1
]) j
=
size
++
;
else
j
=
cal(a);
c[j]
=
a;
}
printf(
"
%d\n
"
,size);
}
return
0
;
}
posted on 2009-04-22 20:23
xfstart07 阅读(84)
评论(0) 编辑 收藏 引用 所属分类:
代码库