Emergency Meeting
InterviewTime limit1sMemory limit256 MB
Given each player's vote or skip, find the player with the most votes, ejecting nobody on a tie.
- Level
Easy2 of 10
- Topics
- Implementation, Array, Simulation
- Solved
- No attempts yet
Problem
The players have gathered in one place for an emergency meeting. In this meeting they will vote to eject one player suspected of being the impostor.
Among the N players, exactly one is the impostor and the rest are crewmates. No player knows whether another player is the impostor or a crewmate.
Each player votes for one player, or skips their vote. The player with the most votes is ejected. If two or more players tie for the most votes, nobody is ejected.
If the number of players who skipped their vote is greater than or equal to the number of votes received by the player with the most votes, the player with the most votes is still ejected.
The voting result of each player is given. Who gets ejected?
Input
The first line gives the number of players N. (3 ≤ N ≤ 100)
The second line gives N integers separated by spaces. The i-th integer Xi means that player i voted for player Xi. If Xi is 0, player i skipped their vote.
Output
Print the number of the player who is ejected as a result of the vote.
If nobody is ejected, print skipped (without the quotes).