CF16D.Logging

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The main server of Gomble company received a log of one top-secret process, the name of which can't be revealed. The log was written in the following format: «[date:time]: message», where for each «[date:time]» value existed not more than 10 lines. All the files were encoded in a very complicated manner, and only one programmer — Alex — managed to decode them. The code was so complicated that Alex needed four weeks to decode it. Right after the decoding process was finished, all the files were deleted. But after the files deletion, Alex noticed that he saved the recordings in format «[time]: message». So, information about the dates was lost. However, as the lines were added into the log in chronological order, it's not difficult to say if the recordings could appear during one day or not. It is possible also to find the minimum amount of days during which the log was written.

So, to make up for his mistake Alex has to find the minimum amount of days covered by the log. Note that Alex doesn't have to find the minimum amount of days between the beginning and the end of the logging, he has to find the minimum amount of dates in which records could be done. (See Sample test 2 for further clarifications).

We should remind you that the process made not more than 10 recordings in a minute. Consider that a midnight belongs to coming day.

Gomble 公司的主服务器接收到了一条关于某顶级机密流程的日志,该流程的名称不得透露。日志采用如下格式记录:«[日期:时间]: 消息»,其中每个 «[日期:时间]» 值至多对应 10 行日志。所有文件均以一种极其复杂的编码方式存储,仅有一位程序员——Alex——成功将其解码。该编码过于复杂,Alex 花费了整整四周才完成解码。解码工作刚一结束,所有原始文件即被删除。然而,在文件删除之后,Alex 才注意到自己保存下来的解码记录格式为 «[时间]: 消息»,因此日期信息已全部丢失。不过,由于日志条目是按时间顺序(即严格的时间先后顺序)逐条写入的,我们仍可据此判断若干条记录是否可能发生在同一天内;进一步地,我们还能确定整份日志所覆盖的最少天数。

因此,为弥补这一失误,Alex 必须计算出该日志所涵盖的最少天数。注意:Alex 并非需要计算日志起始时刻与终止时刻之间所跨的最少天数,而是要找出这些记录可能发生的最少不同日期数量。(参见样例测试 2 以获得更清晰的说明。)

我们提醒您:该流程每分钟最多生成 10 条记录。另外,请注意:午夜(00:00:00)属于次日。

输入格式

The first input line contains number n (1 ≤ n ≤ 100). The following n lines contain recordings in format «[time]: message», where time is given in format «hh:mm x.m.». For hh two-digit numbers from 01 to 12 are used, for mm two-digit numbers from 00 to 59 are used, and x is either character «a» or character «p». A message is a non-empty sequence of Latin letters and/or spaces, it doesn't start or end with a space. The length of each message doesn't exceed 20.

第一行输入包含一个数字 nn(1≤n≤1001 \leq n \leq 100)。接下来的 nn 行包含格式为「[time]: message」的记录,其中时间以格式「hh:mm x.m.」给出:hh 为从 01 到 12 的两位数字,mm 为从 00 到 59 的两位数字,x 为字符 a 或 p。消息是一个非空的拉丁字母和/或空格序列,不以空格开头,也不以空格结尾。每条消息的长度不超过 20。

输出格式

Output one number — the minimum amount of days covered by the log.

输出一个数字——日志所覆盖的最少天数。

输入输出样例

  • 输入#1

    5
    [05:00 a.m.]: Server is started
    [05:00 a.m.]: Rescan initialized
    [01:13 p.m.]: Request processed
    [01:10 p.m.]: Request processed
    [11:40 p.m.]: Rescan completed

    输出#1

    2
  • 输入#2

    3
    [09:00 a.m.]: User logged in
    [08:00 a.m.]: User logged in
    [07:00 a.m.]: User logged in

    输出#2

    3

说明/提示

Formally the 12-hour time format is described at:

  • http://en.wikipedia.org/wiki/12-hour_clock.

The problem authors recommend you to look through these descriptions before you start with the problem.

形式上,12 小时制时间格式的定义参见:

  • http://en.wikipedia.org/wiki/12-hour_clock。

本题出题人建议你在开始解题前先阅读上述说明。

输入解题思路,AI测评打分。不知道怎么写?

首页