Yes or No Vote
Time limit2sMemory limit512 MB
Given N votes coded as 1, -1, or 0, decide whether the vote is APPROVED, REJECTED, or INVALID when abstentions are at least half.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
A yes-or-no vote was held among the students enrolled at Chung-Ang University. Every enrolled student answered the vote with yes, no, or abstain.
The vote passes if the number of yes votes is greater than the number of no votes. If the number of no votes is greater than or equal to the number of yes votes, the vote does not pass. However, if abstentions are at least half of all enrolled students, the vote is invalid regardless of the yes and no counts.
Write a program that reads the votes and prints the result of the vote.
Input
The first line contains the number of enrolled students .
The second line contains votes separated by spaces. A yes vote is given as 1, a no vote as -1, and an abstention as 0.
Output
Print APPROVED if the vote passed, REJECTED if it did not pass, and INVALID if the vote was invalidated.