The squirrel nation is holding a (totally not rigged) election! There are only two candidates in this election: Wesley and Wesley Besley. To reign supreme over the nation, Wesley will do anything to make sure he wins.
The nation is split into
As a very influential candidate, Wesley can force any number of voters to vote for him. Assuming every voter in the nation initially planned to vote for Besley, what is the minimum amount of voters Wesley needs in order to win the election?
For this problem, Python users are recommended to use PyPy over CPython.
Constraints
For this problem, you will NOT be required to pass all the samples to receive points. In addition, you must pass all previous subtasks to earn points for a specific subtask.
For all subtasks:
The total sum of
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line contains an integer
The next
Output Specification
This problem is graded with an identical
checker. This includes whitespace characters. Ensure that every line of output is terminated with a \n
character and that there are no trailing spaces.
On a single line, output an integer representing the minimum amount of voters Wesley needs.
Sample Input 1
5
1 5
1 8
1 0
1 1
1 2
Sample Output 1
2
Sample Explanation 1
By forcing a victory with the first two provinces, Wesley can instantly gain
Sample Input 2
6
4 5
9 8
1 0
1 1
1 2
3 4
Sample Output 2
6
Sample Explanation 2
By forcing a victory with the first, fifth, and sixth provinces, Wesley can win the election by threatening
Comments
I like how in Sample Explanation 2, it's just made clear that Wesley threatens voters.
that's just propaganda. he can win the election because he's a very influential candidate.
The voting doesn't even matter since those who vote decide nothing. It's those who count the vote who decide everything.