{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eWelcome to HDU to take part in the second CCPC girls’ competition!\u003cbr\u003eA new automatic judge system is used for this competition. During the five-hour contest time, you can submit your code to the system, then the judge will reply you. Here is a list of the judge\u0027s replies and their meaning:\u003cbr\u003e\u003cbr\u003e 1. $Accepted (AC) $: Yes, your program is correct. You did a good job!\u003cbr\u003e\u003cbr\u003e 2. $Presentation Error (PE)$ : Your program\u0027s output format is not exactly the same as required by the problem, although the output is correct. This usually means the existence of omitted or extra blank characters (white spaces, tab characters and/or new line characters) between any two non-blank characters, and/or blank lines (a line consisting of only blank characters) between any two non-blank lines. Trailing blank characters at the end of each line and trailing blank lines at the of output are not considered format errors. Check the output for spaces, blank lines, etc. against the problem\u0027s output specification.\u003cbr\u003e\u003cbr\u003e 3. $Wrong Answer (WA)$ : Correct solution not reached for the inputs. The inputs and outputs that we use to test the programs are not public (it is recomendable to get accustomed to a true contest dynamic :-)\u003cbr\u003e\u003cbr\u003e 4. $Runtime Error (RE)$ : Your program failed during the execution and you will receive the hints for the reasons.\u003cbr\u003e\u003cbr\u003e 5. $Time Limit Exceeded (TLE)$ : Your program tried to run during too much time.\u003cbr\u003e\u003cbr\u003e 6. $Memory Limit Exceeded (MLE) $: Your program tried to use more memory than the judge default settings.\u003cbr\u003e\u003cbr\u003e 7. $Output Limit Exceeded (OLE) $: Your program tried to write too much information. This usually occurs if it goes into a infinite loop.\u003cbr\u003e\u003cbr\u003e 8. $Compilation Error (CE) $: The compiler fails to compile your program. Warning messages are not considered errors. Click on the judge\u0027s reply to see the warning and error messages produced by the compiler.\u003cbr\u003e\u003cbr\u003eFor each submission, if it is the first time that the judge returns ``AC\u0027\u0027 on this problem, then it means you have passed this problem, and the current time will be added to the penalty of your team. In addition, every time you pass a problem, each unsuccessful try for that problem before is counted as 20 minutes penalty, it should also be added to the penalty of your team.\u003cbr\u003eNow given the number of problems in the contest and the submission records of a team. Please write a program to calculate the number of problems the team passed and their penalty.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains an integer $T(1\\leq T\\leq20)$, denoting the number of test cases.\u003cbr\u003eIn each test case, there are two integers $n(1\\leq n\\leq 13)$ and $m(1\\leq m\\leq 100)$ in the first line, denoting the number of problems and the number of submissions of a team. Problems are labeled by 1001, 1002, ..., $1000+n$.\u003cbr\u003eIn the following $m$ lines, each line contains an integer $x(1001\\leq x\\leq 1000+n)$ and two strings $t(00:00\\leq t\\leq 05:00)$ and $s$, denoting the team submits problem $x$ at time $t$, and the result is $s$. $t$ is in the format of HH:MM, while $s$ is in the set \\{AC, PE, WA, RE, TLE, MLE, OLE\\}. The team is so cautious that they never submit a CE code. It is guaranteed that all the $t$ in the input is in ascending order and every $t$ is unique.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print a single line containing two integers $A$ and $B$, denoting the number of problems the team passed and the penalty.\u003cbr\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n3 5\r\n1002 00:02 AC\r\n1003 00:05 WA\r\n1003 00:06 WA\r\n1003 00:07 AC\r\n1002 04:59 AC\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2 49\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}