QOJ.ac

QOJ

시간 제한: 2 s 메모리 제한: 256 MB 총점: 100

#21116. מלבני פרות

통계

$N$ הפרות של Farmer John נמצאות בנקודות שונות במישור הדו־ממדי, $1 \leq N \leq 500$. יש שני גזעים: Holsteins ו-Guernseys. הוא רוצה גדר מלבנית שצלעותיה מקבילות לצירים ומכילה רק Holsteins, בלי Guernseys (פרה על הגבול נחשבת בפנים). תחילה ממקסמים את מספר ה-Holsteins, ואז מבין גדרות אלו ממזערים את השטח. מצאו את השטח הזה. רוחב או גובה אפס מותר.

קלט

השורה הראשונה מכילה $N$. $N$ השורות הבאות מתארות פרה בשני שלמים ותו. השלמים הם המיקום $(x,y)$ ($0 \leq x, y \leq 1000$), התו $H$ או $G$ הוא הגזע. אין שתי פרות באותה נקודה, ויש לפחות Holstein אחת.

פלט

הדפיסו שני שלמים: בשורה הראשונה המספר המרבי של Holsteins בגדר בלי Guernseys, ובשנייה השטח המזערי של גדר כזאת.

דוגמאות

קלט 1

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

פלט 1

2
1

מחבר הבעיה: 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.