JDCC '17 Contest 3 S2 - Checking Time

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type

Vedant is nervous for his interview scheduled for time ​T. Due to his nervousness, he is constantly checking his watch. As the creator of his watch software, you are tasked with helping him calm down. To help him calm down, every time he asks for the time more than ​ twice within a five minute period, instead of giving the correct time, tell him the actual time minus ten minutes. If he ever asks during the minute of the scheduled interview, lie to him. (That is, output the actual time minus 10 minutes).

Input Specification

The first line contains ​T​ and ​Q, the time of the interview, and the number of times he asks for the time.

The next ​Q lines each contain a time, when he asks for the time. It is guaranteed that the time is given in increasing order. Assume that all the time is within 12 hours before the interview time.

All time is in ​HH:SS​ format. No padded zeroes for the hour.

\(1 \le​ Q \le 1000\)

Output Specification

Every time Vedant checks the time, output a time, either correct or adjusted.

Sample Input 1

4:20 5
4:05
4:07
4:10
4:11
4:20

Sample Output 1

4:05
4:07
4:10
4:01
4:10

Sample Input 2

1:15 4
6:30
12:55
12:59
1:00

Sample Output 2

6:30
12:55
12:59
1:00

Explanation for Sample Outputs

For the first case, time is adjusted for the second last check because it was 4 minutes since the second last check before that. The last check is adjusted since it was during 4:20–the scheduled interview time.

In the second case, no adjustments are made since there never was three checks within a 5 minute period.


Comments


  • 0
    MstrPikachu  commented on July 28, 2019, 4:25 p.m.

    There are only 5 lines in sample input 1 even though Q = 5


    • 0
      Ninjaclasher  commented on July 29, 2019, 2:44 p.m.

      Fixed, thanks for pointing it out.