eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Kick-Tipp

Kick-Tipp

With the FIFA World Cup 2006^\{TM®†\} a lot of people run world cup pools, where friends or colleagues can join and predict the outcome of the world cup games. The world cup is divided into several rounds, each of which consists of several games. After each game, you gain points for correctly predicting the winner as well as for predicting the exact outcome. After each round, the one who scored highest that round receives a separate point---from now on called a dot---which might later serve as a tie-breaker. If several people have scored highest, a dot is given to all of them. After the world cup, the one who scored highest wins the pot, or, if you decided not to play for money, unstinted admiration for being such an outstanding soccer expert. A few weeks ago you thought that sounded fun, so you are also running a pool for your friends. But now, the world cup is about to end. The finals are tomorrow, and still you do not know who scored how. You decide to write a program that will help you find out. Given a list of the participants, those peoples' bets, and the outcomes of the games, calculate each participant's total number of points as well as the number of dots he received and output the sorted list of scores. With your pool, you gain one point for correctly guessing which team wins, respectively whether the game ends in a draw. You receive two additional points for exactly guessing the correct result. \InputFile The first line contains the number of scenarios. Each scenario starts with a line containing the number of participants \textbf{p} (\textbf{1} ≤ \textbf{p} ≤ \textbf{50}) and the number of rounds \textbf{r} (\textbf{1} ≤ \textbf{r} ≤ \textbf{14}). First come \textbf{p} lines, where the \textbf{i}-th such line contains the name of the \textbf{i}-th participant. Each name is guaranteed to be shorter than \textbf{50} characters. Then follow \textbf{r} descriptions of individual rounds. Each round again consists of individual games, and thus starts with a line containing the number \textbf{g} (\textbf{1} ≤ \textbf{g} ≤ \textbf{16}) of games in this round. Next, there are the g descriptions of these games. A description of a game is given by a line containing the result followed by exactly \textbf{p} lines with the predicted results, where the \textbf{i}-th such line gives the result predicted by participant \textbf{i}. Each result is given in the format \textbf{X : Y }(with one space before and after the colon) where \textbf{X} and \textbf{Y} are non-negative integers. \OutputFile The output for every scenario begins with a line containing "\textbf{Scenario #i:}", where \textbf{i} is the number of the scenario starting at \textbf{1}. Then print a sorted table of \textbf{p} lines giving the number of points, the number of dots , and the names of the participants in the following order: \begin{enumerate} \item Participants with more points rank higher. \item Among those with an equal number of points, participants with more dots rank higher. \item If there is still a tie, use the order of the input. \end{enumerate} In each line, the number of points, the dots, and the name must be separated by single spaces. Terminate the output for the scenario with a blank line.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2
2 2
Gerhard Delling
Guenter Netzer
1
4 : 3
0 : 1
1 : 0
2
1 : 0
1 : 0
1 : 0
0 : 0
2 : 1
0 : 0
3 1
Johannes B. Kerner
Urs Meier
Juergen Klopp
1
2 : 1
2 : 1
2 : 1
2 : 1
Вихідні дані #1
Scenario #1:
7 2 Guenter Netzer
3 0 Gerhard Delling

Scenario #2:
3 1 Johannes B. Kerner
3 1 Urs Meier
3 1 Juergen Klopp