Competitive Arcade Basketball
InterviewTime limit3sMemory limit1024 MB
Add up each player's points in input order and print the players who first reach at least p points, in the order they reach it, or "No winner!" if none do.
- Level
Easy3 of 10
- Topics
- Hash map, Simulation
- Solved
- No attempts yet
Problem
You are attending an arcade basketball competition. The goal is to score as many points as possible before time runs out. The announcer has said the scoreboard is broken, so nobody can track the scores. As an experienced programmer, you decide to write a program that records each player's name and points, then announces the winner or winners at the end of the contest.
Input
The first line contains three integers: the number of participants (), the minimum number of points required to win (), and , the number of lines with player names and points (). The next lines contain the names of the participants, each mentioned exactly once. Each name consists of at most 20 alphanumeric characters. The remaining lines each contain the name of a participant, followed by the number of points they scored (1, 2, or 3).
Output
Output the names of the participants who reached the minimum required score, one per line. Output "<Winner> wins!" for each winner. Output the winners in the order in which they reached the required score. If nobody reaches the minimum required score, output "No winner!" (including the exclamation mark).