#K44532. Max Active Users in a Time Frame

    ID: 27552 Type: Default 1000ms 256MiB

Max Active Users in a Time Frame

Max Active Users in a Time Frame

Given the login times of users and a specified time frame, your task is to determine the maximum number of users that are active within any contiguous interval of the given length.

You are provided with a list of login timestamps (in minutes) and a target time frame (in minutes). Your program needs to calculate the maximum number of login timestamps that fall within any interval of length \(T\), where \(T\) is the provided time frame.

Note:

  • If the list of login times is empty, output No user logins.
  • If the time frame is less than or equal to zero, output Invalid time frame.

Otherwise, output a single integer indicating the maximum number of active users within any such interval.

inputFormat

The input is provided via standard input (stdin) with the following format:

  • The first line contains an integer \(n\), representing the number of login timestamps.
  • The second line contains \(n\) space-separated integers, representing the login times in minutes.
  • The third line contains a single integer, representing the target time frame in minutes.

outputFormat

If \(n = 0\), output No user logins.
If the time frame is less than or equal to zero, output Invalid time frame.
Otherwise, output a single integer that indicates the maximum number of active users within any interval of the given time frame.

## sample
0
5
No user logins