QOJ.ac

QOJ

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

#21116. Rettangoli di mucche

Statistics

Le $N$ mucche di Farmer John occupano punti distinti nel piano, $1 \leq N \leq 500$. Sono di due razze: Holsteins e Guernseys. Vuole un recinto rettangolare con lati paralleli agli assi contenente solo Holsteins, senza Guernseys (anche le mucche sul bordo contano dentro). Prima massimizza le Holsteins incluse, poi minimizza l'area tra questi recinti. Determina l'area. Larghezza o altezza nulla è consentita.

Input

La prima riga contiene $N$. Le successive $N$ righe descrivono una mucca con due interi e un carattere. Gli interi sono la posizione $(x,y)$ ($0 \leq x, y \leq 1000$), il carattere $H$ o $G$ la razza. Nessuna coppia condivide un punto e c'è almeno una Holstein.

Output

Stampa due interi: nella prima riga il massimo numero di Holsteins recintate senza Guernseys, nella seconda l'area minima di un tale recinto.

Esempi

Input 1

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

Output 1

2
1

Autore del problema: 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.