Cow Rectangles
의견: 0
The locations of Farmer John's N cows (1 <= N <= 500) are described by distinct points in the 2D plane. The cows belong to two breeds: Holsteins and Guernseys. Farmer John wants to build a rectangular fence with sides parallel to the coordinate axes enclosing only Holsteins, with no Guernseys (a cow counts as enclosed even if it is on the boundary). Among all such fences, he wants to enclose the maximum number of Holsteins, and among all these, a fence of minimum possible area. Please determine this area. A fence of zero width or height is allowable.
Line 1: N.
Each of the next N lines describes a cow with two integers and a character: a point (x,y) (0 <= x,y <= 1000) and the breed H or G. No two cows are at the same point, and there is always at least one Holstein.
Print two integers: the maximum number of Holsteins that can be enclosed by a fence containing no Guernseys, and the minimum area enclosed by such a fence.
cowrect.incowrect.out5
1 1 H
2 2 H
3 3 G
4 4 H
6 6 H2
1평가 및 의견
Cow Rectangles
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Cow Rectangles