E - Standings

E - Standings

暂无测试数据。

Description

Your task is to simulate the process of a ICPC-Mode Contest.

In a ICPC-Mode Contest, contestants are ranked first by the number of problem they've solved, then by penalty. The penalty will only be applied to a pass problem, and it is calculated as follows:

  • First, the time you spent to solve it (in minutes) is counted into the penalty

  • Then, for each unaccepted solution, \(20\) extra minutes are added to the penalty.

Let us remind you that you will NOT be penallized for an unsolved problem.

The contest has \(t\) participants and have \(m\) problems, conveniently numbered starting from \(A\).

A total of \(n\) submissions are made during the contest. You will be given the submitters and the verdicts, as well as when the submission was made, in order to simplify this problem, the verdict is only OK or FAIL here.

Your output should be a table of standings. It should be Markdown-readable, so here we are going to tell you how to format your table.

First, the columns of your table should be separated with a |. The first line of your table should look like this:

|Rank|Team|=|Penalty|A|B|...|

The first column should be the rank of the team. (If two teams are ranked the same in the aforementioned rule, a tie will be announced.) The second column should be the name of the team, The third column should be the number of solved problems, while the fourth should be the total penalty.

The next columns are details of each problem. The number of it is based on the actual number of problems in the contest, and it should either be empty (if no submissions was mode), or contain a character, either + or -, denoting whether the problem was passed, and an integer, denoting the number of trials. Note that you should not print the integer if the problem was passed on first try.

All adjacent columns are to be separated with a single |, it should also appear at the beginning and the end of all lines.

See the examples for better understanding.

Input

The first line of input contains three space-separated integers \(n, m, t(1\le n \le 10^4, 1 \le m \le 26, 1 \le t \le 100\).

Then \(t\) lines follow, each contains a string of latin letters with length strictly shorter than \(100\) - the names of the teams.

Then \(n\) lines follow, each contains a submission, with three space separated elements:

  • String \(s\), the name of the submitter, it is guaranteed that \(s\) appeared as a team name.
  • Non-negative Integer \(p(p \le 300)\), the time of the submission.
  • Character \(c\), the ID of the problem in interest.
  • String \(v\), either OK or FAIL, the verdict.

Events are given in chronological order.

Output

Print the standings table.

Teams without submissions should NOT be included. Do not print spaces anywhere.

Examples

Sample Input

5 2 2
a
b
c
a 10 A FAIL
b 12 B OK
c 13 A OK
a 17 B FAIL
a 20 A OK

Sample Output

|Rank|Team|=|Penalty|A|B|
|1|b|1|12||+|
|2|c|1|13|+||
|3|a|1|30|+1|-1|

信息

ID
1011
难度
(无)
分类
(无)
标签
(无)
递交数
0
已通过
0
通过率
?
上传者