Basketball
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
In basketball, a player is allowed to hold the ball for a maximum of 5 seconds before they must either pass it to another player or take a shot.
The device logs the exact time when a player receives the ball, recording both the minute and second. Your task is to identify the time of the first rule violation, if any.
Input
The first line contains an integer n, representing the number of device logs. This is followed by n pairs of integers, each indicating the time in minutes and seconds, listed in chronological order.
Output
Print two integers separated by a space, representing the time of the first rule violation in the format minute second. If no violation occurs, output 0.
Examples
Input #1
Answer #1
Submissions 536
Acceptance rate 33%