#K45022. Unique Winner
Unique Winner
Unique Winner
You are given the vote counts for several candidates and you must determine the index (0-indexed) of the candidate who received strictly more votes than every other candidate. In other words, if the votes are given as \(v_0, v_1, \ldots, v_{n-1}\), a candidate at index \(k\) is the winner if and only if
[ v_k > v_i \quad \text{for all } i \neq k ]
If no such candidate exists (i.e. if there is a tie for the highest vote count or the list is empty), output \(-1\).
inputFormat
The input consists of two lines:
- The first line contains an integer \(n\) representing the number of candidates. \(n\) can be zero.
- The second line contains \(n\) space-separated integers representing the vote counts for each candidate.
outputFormat
Output a single integer: the 0-indexed position of the candidate with a unique maximum vote. If no candidate meets the criteria, output \(-1\).
## sample5
10 20 30 40 50
4