301313: CF245F. Log Stream Analysis
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Log Stream Analysis
题意翻译
## 题目描述 现在给你一份日志,有若干行,每一行由`2012-月-日 时:分:秒:日志信息`,时间为24小时计时法,日志信息中可能会有空格。你的任务是找出第一个往前n秒中有不少于m条日志的在日志里的时刻。 ## 输入格式 共有若干行,第一行为n和m(1<=n,m<=10000)。第二行开始是日志内容。 ## 输出格式 如果有这个时刻就输出这个时刻+这个时刻的日志信息(就是这个时刻的输入),否则输出`-1`。题目描述
You've got a list of program warning logs. Each record of a log stream is a string in this format: "2012-MM-DD HH:MM:SS:MESSAGE" (without the quotes). String "MESSAGE" consists of spaces, uppercase and lowercase English letters and characters "!", ".", ",", "?". String "2012-MM-DD" determines a correct date in the year of 2012. String "HH:MM:SS" determines a correct time in the 24 hour format. The described record of a log stream means that at a certain time the record has got some program warning (string "MESSAGE" contains the warning's description). Your task is to print the first moment of time, when the number of warnings for the last $ n $ seconds was not less than $ m $ .输入输出格式
输入格式
The first line of the input contains two space-separated integers $ n $ and $ m $ $ (1<=n,m<=10000) $ . The second and the remaining lines of the input represent the log stream. The second line of the input contains the first record of the log stream, the third line contains the second record and so on. Each record of the log stream has the above described format. All records are given in the chronological order, that is, the warning records are given in the order, in which the warnings appeared in the program. It is guaranteed that the log has at least one record. It is guaranteed that the total length of all lines of the log stream doesn't exceed $ 5·10^{6} $ (in particular, this means that the length of some line does not exceed $ 5·10^{6} $ characters). It is guaranteed that all given dates and times are correct, and the string 'MESSAGE" in all records is non-empty.
输出格式
If there is no sought moment of time, print -1. Otherwise print a string in the format "2012-MM-DD HH:MM:SS" (without the quotes) — the first moment of time when the number of warnings for the last $ n $ seconds got no less than $ m $ .
输入输出样例
输入样例 #1
60 3
2012-03-16 16:15:25: Disk size is
2012-03-16 16:15:25: Network failute
2012-03-16 16:16:29: Cant write varlog
2012-03-16 16:16:42: Unable to start process
2012-03-16 16:16:43: Disk size is too small
2012-03-16 16:16:53: Timeout detected
输出样例 #1
2012-03-16 16:16:43
输入样例 #2
1 2
2012-03-16 23:59:59:Disk size
2012-03-17 00:00:00: Network
2012-03-17 00:00:01:Cant write varlog
输出样例 #2
-1
输入样例 #3
2 2
2012-03-16 23:59:59:Disk size is too sm
2012-03-17 00:00:00:Network failute dete
2012-03-17 00:00:01:Cant write varlogmysq
输出样例 #3
2012-03-17 00:00:00