QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21116. Krowie prostokąty

Statistics

Krowy Farmer John, w liczbie $N$, zajmują różne punkty płaszczyzny, $1 \leq N \leq 500$. Są dwie rasy: Holsteins i Guernseys. Chce prostokątne ogrodzenie o bokach równoległych do osi, zawierające tylko Holsteins, bez Guernseys (krowa na brzegu też liczy się wewnątrz). Najpierw maksymalizuje liczbę Holsteins, potem minimalizuje pole spośród takich ogrodzeń. Znajdź to pole. Zerowa szerokość lub wysokość jest dozwolona.

Wejście

Pierwszy wiersz zawiera $N$. Kolejne $N$ wierszy opisuje po jednej krowie dwiema liczbami całkowitymi i znakiem. Liczby to pozycja $(x,y)$ ($0 \leq x, y \leq 1000$), znak $H$ lub $G$ to rasa. Żadne dwie krowy nie są w tym samym punkcie, jest co najmniej jedna Holstein.

Wyjście

Wypisz dwie liczby całkowite: w pierwszym wierszu maksymalną liczbę Holsteins bez Guernseys w ogrodzeniu, w drugim minimalne pole takiego ogrodzenia.

Przykład

Wejście 1

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

Wyjście 1

2
1

Autor zadania: 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.