Nộp bài  Các bài nộp  Làm tốt nhất  Về danh sách bài 
KSTEEPLE  Cow Steeplechase 
Farmer John has a brilliant idea for the next great spectator sport: Cow Steeplechase! As everyone knows, regular steeplechase involves a group of horses that race around a course filled with obstacles they must jump over. FJ figures the same contest should work with highlytrained cows, as long as the obstacles are made short enough. In order to design his course, FJ makes a diagram of all the N (1 ≤ N ≤ 250) possible obstacles he could potentially build. Each one is represented by a line segment in the 2D plane that is parallel to the horizontal or vertical axis. Obstacle i has distinct endpoints (X1_i, Y1_i) and (X2_i, Y2_i) (1 ≤ X1_i, Y1_i, X2_i, Y2_i ≤ 1,000,000,000). An example is as follows:
FJ would like to build as many of these obstacles as possible, subject to the constraint that no two of them intersect. Starting with the diagram above, FJ can build 7 obstacles:
Two segments are said to intersect if they share any point in common, even an endpoint of one or both of the segments. FJ is certain that no two horizontal segments in the original input diagram will intersect, and that similarly no two vertical segments in the input diagram will intersect.
Please help FJ determine the maximum number of obstacles he can build.
Input
 Line 1: A single integer: N.
 Lines 2..N+1: Line i+1 contains four spaceseparated integers representing an obstacle: X1_i, Y1_i, X2_i, and Y2_i.
Output
 Line 1: The maximum number of noncrossing segments FJ can choose.
Example
Input:
3
4 5 10 5
6 2 6 12
8 3 8 5
Output:
2
Explain: There are three potential obstacles. The first is a horizontal segment connecting (4, 5) to (10, 5); the second and third are vertical segments connecting (6, 2) to (6, 12) and (8, 3) to (8, 5).
Được gửi lên bởi:  Nguyễn Xuân Khánh 
Ngày:  20111119 
Thời gian chạy:  0.460s 
Giới hạn mã nguồn:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Ngôn ngữ cho phép:  Tất cả ngoại trừ: ASM64 GOSU PERL6 PYPY RUST SED 
Nguồn bài:  USACO November 2011 
hide comments
20180626 13:27:48
Đọc đề tại http://www.usaco.org/index.php?page=viewproblem2&cpid=93 

20130107 18:02:41 Lệ Rơi
link ảnh bị die rồi ạ :( 