Logo
(追記) (追記ここまで)

10669번 - Cow Rectangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB270926931.222%

문제

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 different 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 of the fence). Among all such fences, Farmer John wants to build a fence enclosing the maximum number of Holsteins. And among all these fences, Farmer John wants to build a fence of minimum possible area. Please determine this area. A fence of zero width or height is allowable.

입력

The first line of input contains N. Each of the next N lines describes a cow, and contains two integers and a character. The integers indicate a point (x,y) (0 <= x, y <= 1000) at which the cow is located. The character is H or G, indicating the cow's breed. No two cows are located at the same point, and there is always at least one Holstein.

출력

Print two integers. The first line should contain the maximum number of Holsteins that can be enclosed by a fence containing no Guernseys, and second line should contain the minimum area enclosed by such a fence.

제한

예제 입력 1

5
1 1 H
2 2 H
3 3 G
4 4 H
6 6 H

예제 출력 1

2
1

힌트

출처

Olympiad > USA Computing Olympiad > 2014-2015 Season > USACO January 2015 Contest > Gold 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /