#C10306. Most Frequent Server User
Most Frequent Server User
Most Frequent Server User
You are given a list of log entries from a server. Each log entry consists of a user name and a timestamp when the user accessed the server. Given a time interval \([start, end]\), your task is to determine the user who accessed the server the most times during that interval. If there are multiple users with the highest access count, return the lexicographically smallest user name. If no log entries fall within the specified interval, output None.
Note: The time interval is inclusive, meaning that both the start and end timestamps are considered valid.
inputFormat
The input is read from standard input (stdin) and has the following format:
- A single integer n, representing the number of log entries.
- n lines each containing a string and an integer separated by space, where the string represents the user name and the integer represents the timestamp of access.
- A single line containing two integers, start and end, separated by a space.
For example:
6 alice 5 bob 7 alice 9 charlie 10 bob 11 alice 14 5 10
outputFormat
Output to standard output (stdout) the user name who accessed the server the most times within the given interval. If no log entry falls within the interval, print None
. In case of a tie, output the lexicographically smallest user name.
6
alice 5
bob 7
alice 9
charlie 10
bob 11
alice 14
5 10
alice