#K77812. Unauthorized Facility Access Detection
Unauthorized Facility Access Detection
Unauthorized Facility Access Detection
You are given a swipe log recording the times when individuals enter a secured facility. Each entry in the log is provided in the format HH:MM Name
, where HH:MM
represents the time in 24-hour format and Name
is the individual's name.
An individual is considered to have unauthorized access if there exists any period of \(60\) minutes during which they swiped at least three times. Your task is to analyze the swipe log and identify all individuals with unauthorized access.
If one or more individuals meet the unauthorized criteria, output their names in alphabetical order, each on a new line. If no individual meets the criteria, output No unauthorized access
.
Note: The time difference should be computed in minutes. For example, if a person swipes at times \(t_1\), \(t_2\), and \(t_3\) (in minutes) with \(t_3 - t_1 < 60\), then this person has unauthorized access.
inputFormat
The input is given from standard input (stdin) in the following format:
n swipe_1 swipe_2 ... swipe_n
Where:
n
is an integer representing the number of swipe records.- Each of the following
n
lines contains a swipe record in the formatHH:MM Name
.
outputFormat
Output to standard output (stdout):
- If there is at least one individual with unauthorized access, print each such individual's name on a new line in alphabetical order.
- If no one has unauthorized access, print
No unauthorized access
.
10
08:00 Alice
08:10 Bob
08:20 Alice
09:00 Alice
08:30 Alice
08:50 Bob
09:05 Alice
08:55 Alice
09:10 Bob
08:40 Bob
Alice
Bob
</p>