Problem H. Rectangles Too!
时间限制 8000 ms
内存限制 32 MB
A rectangle in the Cartesian plane is speci ed by a pair of coordinates (x1 , y1) and (x2 , y2) indicating its lower-left and upper-right corners, respectively (where x1 ≤ x2 and y1 ≤ y2). Given a pair of rectangles,A = ((x
A
1 , y
A
1 ), (x
A
2 ,y
A
2 )) and B = ((x
B
1 , y
B
1 ), (x
B
2 , y
B
2 )), we write A ≤ B (i.e., A "precedes" B), if x
A
2 < x
B
1 and y
A
2 < y
B
1 :In this problem, you are given a collection of rectangles located in the two-dimension Euclidean plane. Find the length L of the longest sequence of rectangles (A
1,A
2,…,A
L) from this collection such that A
1 ≤ A
2 ≤ … ≤ A
L.
输入数据
输出数据
For each input test case, print a single integer indicating the length of the longest chain.
样例输入
复制
3
1 5 2 8
3 -1 5 4
10 10 20 20
2
2 1 4 5
6 5 8 10
0
样例输出
$ Mathjax font initiator $