Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: Economic Phone Calls
Description The phone you bought a long time ago has a built-in memory that keeps track of all the calls you receive. It logs the date (month and day) and the time (hour and minute) of each call along with the caller’s number. Only a limited number of calls can be logged (memory was still expensive then). You discover that the limit is almost reached and therefore plan to delete some entries from the log. In choosing the entries to delete you have to consider two restrictions:
Calculate the minimal number of entries that must be kept to satisfy these requirements. Recovery of yearsGiven a list of timestamps (consisting of month, day, hour, and minute) of calls, you find out the year of each call by the following procedure:
Note that this procedure is not correct in general, but you may assume that it is for the input you get, and you have to ensure that it gives the same result for the shortened log. Input The input consists of several test cases. Every test case starts with the number of entries n in the log, where 1 ≤ n ≤ 1000. Each of the next n lines contains an entry. Every entry has the format You may assume that the recovery procedure described above yields the correct year of each call. The last test case is followed by a Output For each test case, output the minimal number of entries that must be kept to satisfy the requirements stated above. In particular, the recovery procedure described above must yield for each remaining entry the same year as derived from the corresponding input. Sample Input 7 12:31:23:59 0123456789012345 + 07:21:19:00 1337 - 01:01:00:00 0987654321 - 07:21:14:00 1337 - 11:11:11:11 11111111111 + 01:01:00:00 0123456789 + 01:01:00:00 0987654321 - 0 Sample Output 6 Hint Due to an error in the phone’s software no calls have been logged on February 29. Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator