#K80442. Overloaded Servers

    ID: 35531 Type: Default 1000ms 256MiB

Overloaded Servers

Overloaded Servers

You are given a list of request times in milliseconds and a threshold k. Your task is to determine whether there exists any sliding window of 1000 milliseconds (i.e., 1 second) where the number of requests is strictly greater than k. In other words, if for any starting time \(t_i\) there are more than k subsequent requests that occur before \(t_i + 1000\), the servers are considered overloaded.

Mathematically, given request times \(t_1, t_2, \dots, t_n\) sorted in non-decreasing order, find for some index \(i\) the largest index \(j\) satisfying \[ t_j k\). Note that if a window has exactly k requests, it is not considered overloaded.

inputFormat

The input is given in two lines. The first line contains two integers n and k where n is the number of requests and k is the threshold. If n > 0, the second line contains n space-separated integers representing the request times (in milliseconds). If n = 0, the second line will be omitted.

outputFormat

Output a single line: True if any 1000-millisecond window has more than k requests, otherwise output False.

## sample
0 3
False

</p>