PROBLEM LINK:
Author: Arjun Jaiswal
Editorialist: Pawan Mishra
DIFFICULTY:
CAKEWALK
PROBLEM:
N people take part in voting process in a bid to Rename the krypton city. People cast their vote in form of 1, -1 or 0 showing that they support, oppose and are neutral to name change process, respectively. Print “YES” if the city will be renamed else “NO”.
EXPLANATION:
City will be renamed if number of 1’s are greater than or equal to number of -1’s, that is if no of people supporting renaming are greater than or equal in number to those against it.
Count the number of 1’s and number of -1’s and compare them.
Alternatively, simply add the input votes. Finally, if sum is greater than or equal to 0, then ans is “YES” else “NO”.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.