#K70472. Determine the Game Winner
Determine the Game Winner
Determine the Game Winner
This problem requires you to determine the winner of a game based on the scores of several players. Each player’s information is given on a separate line with their identifier (name) followed by a series of integer scores. The total score of a player is the sum of all the scores provided. If exactly one player has the highest total score, that player is declared the winner and the output should be in the format Winner: <identifier>
. If more than one player shares the highest total score, the game is considered a draw and you should output Draw
.
Mathematically, if we denote the scores for each player by \(s_{i1}, s_{i2}, \ldots, s_{ik}\), then the total score for player \(i\) is given by:
[ T_i = \sum_{j=1}^{k} s_{ij} ]
The goal is to find the player with the maximum \(T_i\). If the maximum value occurs uniquely, print that player's identifier, otherwise print "Draw".
inputFormat
The first line contains a single integer \(n\) representing the number of players. Each of the following \(n\) lines contains a player's data in the following format:
name score1 score2 ... scorek
There will be at least one score for each player.
outputFormat
Print exactly one line. If there is a unique winner, output Winner: <identifier>
where <identifier>
is the name of the winning player. Otherwise, if there is a tie for the highest score, print Draw
.
2
Alice 10 20 30
Bob 20 30 10
Draw