408728: GYM103274 F Fixing Subtitles

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Fixing Subtitlestime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Jaime is watching a movie, since it's late and all his family is sleeping, he decided to enable subtitles and watch the movie without sound. But, what a surprise, the subtitles are out of sync! He reads the subtitles before some actor in the movie speaks, unacceptable! As the good programmer Jaime is, he decided to look for the file where the subtitles are stored in the movie, he found the file and it's very big! So he will write a program to fix the subtitles and continue watching the movie.

After looking at the file, Jaime found that the subtitles have a well defined structure:

  1. A subtitle begins with a line with a number that appears to be a sequence number of the subtitle.
  2. The next line contains a string, apparently the time at miliseconds precision where the subtitle should be displayed in the screen and the time when it should be removed from screen separated by the string " –> ", the time is displayed in the format "Hours:Minutes:Seconds,Miliseconds".
  3. Finally, one or two lines with the text to be displayed as subtitle. Two subtitles are separated each other with a blank line. And the lines with the subtitle text do not have trailing or leading whitespaces.

The subtitles file looks something like this:


1
00:00:00,498 –> 00:00:02,827
- Here's what I love most
about food and diet.

2
00:00:02,827 –> 00:00:06,383
We all eat several times a day,

3
00:00:06,383 –> 00:00:09,427
of what goes on our plate
and what stays off.

The movie does not last more than 10 hours, and subtitles are at most delayed 10 seconds.

Given the subtitles file and the delay in the subtitles, Can you help Jaime write a program to sync the subtitles of the movie?

Input

The first line of input contains an integer number and a float number with three decimal places, representing the number of subtitles in the file and the delay Jaime found the subtitles have. Then $$$N$$$ ($$$1 \leq N \leq 5000$$$) subtitles will be given in the input, using the format specified in the problem statement. No subtitle line is longer than 200 characters.

Output

You need to print exactly the same subtitles content, with the adjusted start and end times for each subtitle in the file.

ExampleInput
3 3.200
1
00:00:00,498 --> 00:00:02,827
- Here's what I love most
about food and diet.

2
00:00:02,827 --> 00:00:06,383
We all eat several times a day,

3
00:00:06,383 --> 00:00:09,427
of what goes on our plate
and what stays off.
Output
1
00:00:03,698 --> 00:00:06,027
- Here's what I love most
about food and diet.

2
00:00:06,027 --> 00:00:09,583
We all eat several times a day,

3
00:00:09,583 --> 00:00:12,627
of what goes on our plate
and what stays off.

加入题单

上一题 下一题 算法标签: