#S0007. 用户停留时长
用户停留时长
1. Description
In addition to visit frequency, we also want to know how long users have been using our app.
Implement a page dwell time analyzer. Input multiple user visit records (format: userID enter_time exit_time, e.g., u123 09:30 09:35). Calculate each user's total dwell time in minutes and output the top 3 users with the longest duration. Tie-breaking rules:
- Sort by latest exit time
- If exit times are identical, sort by userID alphabetically
2. Input & Output
Input:
- Multiple lines of
userID enter_time exit_time(time inHH:MMformat, exit always after enter) - End input with
EOF
Output:
- Top 3 users in format
userID total_minutes last_exit_time - Each user in a separate line
Example
# Input:
u1 09:00 09:05
u2 10:00 10:15
u1 11:30 11:45
u3 14:00 14:30
u2 15:00 15:10
# Output:
u1 20 11:45
u2 25 15:10
u3 30 14:30
# Input:
bot5 00:00 00:30
human 13:05 13:20
bot5 01:00 01:25
human 14:00 14:15
# Output:
bot5 55 01:25
human 30 14:15