#d2455. 简单分数统计
简单分数统计
Simple Score Statistics
Problem Description
friends take part in a Codeforces contest that consists of problems, and during the contest there are submissions in total on Codeforces.
You know the score of each problem. However, since they can only see the complete submission records during the contest (which also include submissions from other users on other problems, i.e. problems not belonging to this contest), they would like you to write a program to calculate each person's score.
Input Format
The first line contains three integers , , , denoting the number of friends, the number of problems, and the total number of submissions ().
The next lines: the -th line contains the id of the -th person.
The next lines: the -th line contains the name and the score of the -th problem.
The next lines: the -th line contains the submitter's id, the problem name, and the result ("WA" or "AC"); an "AC" means passing that problem, and the submitter gets the corresponding score.
Note: both problem names and ids are strings consisting only of English letters and digits; problem scores are positive integers not exceeding . Multiple inputs on each line are separated by spaces.
The length of every input string satisfies .
All user ids and problem names are distinct; once a user gets AC on a problem, they will not submit that problem again; the friends only submit problems that belong to the contest.
Output Format
Output lines: the -th line outputs the -th person's name and corresponding score (separated by a space).
Sample Input
2 2 4
GabrielPessoa
beza
metebronca 100
geometry 200
beza metebronca AC
ffern numbertheory AC
GabrielPessoa geometry WA
beza geometry AC
Sample Output
GabrielPessoa 0
beza 300
Sample Explanation
beza passed metebronca and geometry, scoring .
GabrielPessoa did not pass any problem, so the score is .
There are also submissions from other contestants on other problems, which are ignored.