Back
Close
  • 204

Statement

 Goal

Your program must output the number of Yes No valid votes.

Voters can have proxy votes. Input gives you how many votes each voter has.
A list of votes following the format "<Voter name> <Vote>" is given.

One vote is invalid if :
- it is neither Yes, nor No;
- the voter voted more than he is allowed to (all his votes are invalid);
- the person that voted is not in the list of voters.
Input
Line 1: The number N of voters as integer.
Line 2: The number M of votes as integer.
The N following lines: The name of a voter person_name as a string, and his number of votes nb_vote he can use.
The M following lines: Two string, the voter name voter_name, and his vote vote_value.
Output
Line 1: The number of Yes and No votes.
Constraints
0 < N < 10
0 < M < 10
Example
Input
2
3
Albert 2
Roger 1
Albert Yes
Roger No
Albert Yes
Output
2 1

A higher resolution is required to access the IDE