#123. ACM? 你也想打ACM?

ACM? 你也想打ACM?

Time limit: 1 seconds

Memory limit: 256 megabytes

A man sometimes devotes his life to a desire which he is not sure will ever be fulfilled. —Rashomon, Writer, Ryūnosuke Akutagawa

题目描述

ACM赛制介绍:比赛中共有n道题,有多次提交机会。比赛实时评测并返回结果,如果提交的结果错误会有 20 分钟的罚时,错误次数越多,加罚的时间也越长。每个题目只有在所有数据点全部正确后才能得到分数。比赛排名根据做题数来评判,做题数相同的,根据总用时来评判。总用时是每道已通过题目用时的和。每题的用时是从比赛开始到第一次做出该题的分钟数与这一个时间段内该题的罚时之和。

现在zjh正在参加一场ACM赛制的比赛。这场比赛有nn个题,编号为1n1 -n,zjh共有kk次提交记录,你需要输出zjh最后的通过题数和总用时。

输入

11行输入两个正整数n,kn, k

22行到第k+1k+1行,每行一个提交记录,格式为id:time:msgid:time:msg

其中idid为题目序号;

timetime为提交时间,格式为hhmmhh-mm,表示在比赛中的第hhhh小时第mmmm分钟时提交程序;

msgmsg为提交结果。若msg="accepted"msg="accepted"则题目通过;若msg="unaccepted"msg="unaccepted"则题目不通过。

输出

输出两个数x,yx, y,分别代表通过题目数量和总用时(以分钟数表示),以一个空格分开。

限制

n,k1.5106, 1idnn, k \leq 1.5 \cdot 10^{6}, \ 1 \leq id \leq n

0hh<24, 0mm<600 \leq hh < 24, \ 0 \leq mm < 60

msg{"accepted","unaccepted"}msg \in \{"accepted", "unaccepted"\}

保证kk条提交记录中按提交时间升序排序

4 7
1:0-0:unaccepted
1:0-1:accepted
2:0-2:unaccepted
2:0-3:accepted
2:0-4:unaccepted
3:0-5:unaccepted
4:0-6:accepted
3 50
13 20
9:0-1:unaccepted
5:0-6:unaccepted
5:0-55:accepted
5:1-0:unaccepted
7:2-17:unaccepted
6:3-41:unaccepted
5:5-12:unaccepted
5:10-35:accepted
11:10-49:unaccepted
12:10-54:unaccepted
4:11-15:accepted
11:11-27:unaccepted
8:13-21:unaccepted
4:13-40:unaccepted
7:14-11:accepted
6:14-21:unaccepted
11:16-23:unaccepted
1:20-18:accepted
6:21-9:unaccepted
5:21-37:unaccepted
4 2839

Postscript

For someone special: I was surprised, as always, by how easy the act of leaving was, and how good it felt. The world was suddenly rich with possibility.