QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 256 MB 満点: 100

#21116. Hình chữ nhật bò

統計

Các con bò của Farmer John, gồm $N$ con, ở các điểm khác nhau trong mặt phẳng hai chiều, $1 \leq N \leq 500$. Có hai giống: Holsteins và Guernseys. Ông muốn hàng rào chữ nhật có cạnh song song trục tọa độ, chỉ chứa Holsteins, không Guernseys (bò trên biên cũng tính bên trong). Trước tiên tối đa số Holsteins, rồi tối thiểu diện tích giữa những hàng rào như vậy. Hãy tìm diện tích đó. Chiều rộng hoặc cao bằng không được phép.

Dữ liệu vào

Dòng đầu chứa $N$. $N$ dòng tiếp mỗi dòng mô tả bò bằng hai số nguyên và ký tự. Các số là vị trí $(x,y)$ ($0 \leq x, y \leq 1000$), ký tự $H$ hoặc $G$ là giống. Không hai bò cùng điểm và luôn có ít nhất một Holstein.

Dữ liệu ra

In hai số nguyên: dòng đầu là số Holsteins lớn nhất trong rào không Guernseys, dòng thứ hai là diện tích nhỏ nhất của rào như vậy.

Ví dụ

Dữ liệu vào 1

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

Dữ liệu ra 1

2
1

Tác giả bài toán: Nick Wu, 2015

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.