#C4174. Active Users by Session Time
Active Users by Session Time
Active Users by Session Time
You are given a series of session records for different users. Each record is in the format username start_time end_time
, where start_time
and end_time
are in the 24-hour format HH:MM
. Your task is to calculate the total session time (in minutes) for each user and print the names of the users whose total session time is at least a given threshold.
Let \(T\) be the total session time for a user. A user is considered active if \[ T \geq \text{threshold} \] Otherwise, the user is not active. The output should be a comma-separated list of active users sorted in alphabetical order. If no user meets the threshold, print an empty string.
inputFormat
The first line contains two integers N
and threshold
separated by a space, where N
is the number of session records.
The next N
lines each contain a session record in the format:
username start_time end_time
Here, start_time
and end_time
are given in 24-hour format (HH:MM).
outputFormat
Print a single line containing a comma-separated list of active users, sorted alphabetically, whose total session time is at least the given threshold. If there are no active users, output an empty string.
## sample3 45
alice 09:00 10:30
bob 11:00 12:00
charlie 15:00 16:00
alice,bob,charlie