Halli Galli
InterviewTime limit1sMemory limit1024 MB
Given the revealed cards, decide whether any single fruit kind totals exactly 5 across all cards so Hanbyeol should ring the bell.
- Level
Easy2 of 10
- Topics
- Implementation, Hash map
- Solved
- No attempts yet
Problem

Figure B.1: Halli Galli
Halli Galli is a board game made of a bell with a button and cards with drawn fruits.
Each card shows up to fruits. There are kinds of fruit: strawberry, banana, lime, and plum.
At the start, players split the deck evenly. A player who uses up all their cards loses.
The game starts when the first player reveals one card from their deck. After that, players reveal one card each in counterclockwise order.
If the revealed cards contain exactly fruits of at least one kind, players must ring the bell. The player who rings first takes all the revealed cards and places them under their own deck. A player who rings incorrectly gives one card to each of the other players.
Hanbyeol is new to Halli Galli and wants to beat Hina, an expert. Given the list of revealed cards, tell Hanbyeol whether to ring the bell.
Input
The first line contains the number of revealed cards .
Each of the next lines contains one revealed card. A card is given as a fruit kind and a positive integer for the number of fruits, separated by a space.
is one of STRAWBERRY, BANANA, LIME, or PLUM.
Output
Print YES if Hanbyeol should ring the bell. Otherwise, print NO.
Constraints
- All numbers in the input are integers.