QOJ.ac

QOJ

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

#20916. 동물 맞히기

Statistics

평소의 컵 맞히기 게임이 지겨워지면 소 Bessie와 친구 Elsie는 흔한 다른 게임인 "동물 맞히기"를 합니다.

Bessie는 동물을 생각합니다. 대부분 소라서 지루하지만 가끔 창의적으로 다른 동물을 고릅니다. Elsie는 그것을 알아내려고 질문하며, 각 질문은 특정 특징이 있는지 묻습니다. Bessie는 "예" 또는 "아니요"로 답합니다. 예를 들어:

Elsie: "동물이 날 수 있어?"
Bessie: "아니요"
Elsie: "풀을 먹어?"
Bessie: "예"
Elsie: "우유를 만들어?"
Bessie: "예"
Elsie: "음메 하고 울어?"
Bessie: "예"
Elsie: "그럼 소라고 생각해."
Bessie: "맞아!"

지금까지의 답과 일치하는 모든 동물을 "가능 집합"이라 하면, Elsie는 하나만 남을 때까지 질문하고 그것을 답으로 말합니다. 매번 집합의 어느 동물이 가진 특징을 고르며, 더 줄이는 데 도움이 되지 않아도 됩니다. 같은 특징을 두 번 묻지는 않습니다.

둘이 아는 모든 동물과 특징이 주어질 때, 올바른 동물을 알기 전에 Elsie가 받을 수 있는 "예" 답변의 최대 횟수를 구하세요.

입력

표준 입력에서 읽으세요.

첫 줄은 동물 수 $N$($2 \leq N \leq 100$)입니다. 다음 $N$개 줄은 각 동물을 설명합니다. 이름, 정수 $K$($1 \leq K \leq 100$), 그리고 $K$개 특징이 나옵니다. 이름과 특징은 길이 20 이하의 소문자(a..z) 문자열입니다. 완전히 같은 특징을 가진 두 동물은 없습니다.

출력

표준 출력에 쓰세요.

게임이 끝나기 전 받을 수 있는 "예"의 최대 횟수를 출력하세요.

예제

입력 1

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

출력 1

3

참고

예제에서는 위 대화처럼 3번의 "예"가 가능하지만 3번을 초과할 수 없습니다.

문제 작성자: 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.