#include
<
iostream
>
using
namespace
std;
struct
arr{
int
x,y;
}a[
1000
];
int
n;
int
f[
1000
];
int
cmp(
const
void
*
no1,
const
void
*
no2){
arr
*
nox
=
(arr
*
)no1,
*
noy
=
(arr
*
)no2;
if
(nox
->
x
!=
noy
->
x)
return
nox
->
x
-
noy
->
x;
else
return
nox
->
y
-
noy
->
y;
}
int
main()
{
freopen(
"
stick.in
"
,
"
r
"
,stdin);
freopen(
"
stick.out
"
,
"
w
"
,stdout);
scanf(
"
%d
"
,
&
n);
for
(
int
i
=
0
;i
<
n;
++
i)
scanf(
"
%d%d
"
,
&
a[i].x,
&
a[i].y);
qsort(a,n,
sizeof
(arr),cmp);
int
MAX
=
0
;
for
(
int
i
=
0
;i
<
n;
++
i){
f[i]
=
1
;
for
(
int
j
=
i
-
1
;j
>=
0
;
--
j)
if
(a[i].y
<
a[j].y
&&
f[i]
<
f[j]
+
1
)
f[i]
=
f[j]
+
1
;
if
(f[i]
>
MAX) MAX
=
f[i];
}
printf(
"
%d\n
"
,MAX);
return
0
;
}
posted on 2009-05-01 16:45
xfstart07 阅读(1011)
评论(2) 编辑 收藏 引用 所属分类:
代码库