QOJ.ac

QOJ

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

#20916. Indovina l'animale

統計

Quando si annoiano del solito gioco dei bicchieri, la mucca Bessie e l'amica Elsie giocano a «indovina l'animale».

Bessie pensa a un animale, quasi sempre una mucca, rendendo il gioco noioso, ma a volte sceglie creativamente altro. Elsie pone domande per identificarlo. Ogni domanda chiede una caratteristica specifica, e Bessie risponde «sì» o «no». Per esempio:

Elsie: "L'animale vola?"
Bessie: "No"
Elsie: "L'animale mangia erba?"
Bessie: "Sì"
Elsie: "L'animale produce latte?"
Bessie: "Sì"
Elsie: "L'animale fa muu?"
Bessie: "Sì"
Elsie: "Allora penso che sia una mucca."
Bessie: "Corretto!"

Chiamiamo insieme possibile gli animali compatibili con le risposte precedenti. Elsie domanda finché ne rimane uno e lo annuncia come risposta. Ogni domanda riguarda una caratteristica di qualche animale dell'insieme, anche se non lo restringe. Non chiede mai due volte la stessa caratteristica.

Dati tutti gli animali che conoscono e le loro caratteristiche, determina il massimo numero di risposte «sì» che Elsie può ricevere prima di conoscere l'animale corretto.

Input

Leggi dallo standard input.

La prima riga contiene il numero di animali $N$ ($2 \leq N \leq 100$). Ognuna delle successive $N$ righe descrive un animale: nome, intero $K$ ($1 \leq K \leq 100$), poi $K$ caratteristiche. Nomi e caratteristiche sono stringhe di al massimo 20 lettere minuscole (a..z). Nessuna coppia ha esattamente le stesse caratteristiche.

Output

Scrivi sullo standard output.

Stampa il massimo numero di risposte «sì» prima della fine del gioco.

Esempi

Input 1

4
bird 2 flies eatsworms
cow 4 eatsgrass isawesome makesmilk goesmoo
sheep 1 eatsgrass
goat 2 makesmilk eatsgrass

Output 1

3

Spiegazione

Nell'esempio si possono ottenere 3 risposte «sì», come sopra, ma non più di 3.

Autore del problema: Brian Dean

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.