#K44847. Election Winner Determination
Election Winner Determination
Election Winner Determination
In this problem, you are given a sequence of votes represented as integers. Each vote corresponds to a candidate's number. Your task is to determine the winner of the election. The winner is the candidate that has received the highest number of votes. If there is exactly one candidate with the maximal number of votes, output that candidate's number. Otherwise, if more than one candidate shares the maximum vote count, output Tie
. Formally, if we denote the vote count for candidate \( c \) as \( f(c) \), then you should output the unique candidate \( c \) for which \( f(c)=\max\{f(x)\} \) if it exists; otherwise output Tie
.
inputFormat
The input is given from standard input. The first line contains a single integer \( n \), which represents the number of votes. The second line contains \( n \) space-separated integers. Each integer represents a vote for a candidate.
outputFormat
Print to standard output the winning candidate's number if there is a unique candidate with the highest vote count; otherwise, print Tie
.
5
5 2 6 2 2
2