Problem A. Winner
To solve the problem we just need accurately follow all rules described in the problem statement. Let's describe in more details required sequence of actions.
- First of all, we need to find the maximum score m at the end of the game. This can be done by emulating. After all rounds played just iterate over players and choose one with the maximum score.
- Second, we need to figure out the set of players who have maximum score at the end of the game. We can do this in the same way as calculating maximum score. Just iterate over players after all rounds played and store all players with score equal to m.
- And the last, we need to find a winner. To do this we will emulate the game one more time looking for player from the winner list with score not less m after some round.