Teeth
Limits: 2 sec., 256 MiB
Little Imp has N teeth. The i-th tooth has a sharp coeficient \(\mathbf{A_i}\).
Little Imp calls a tooth “cool” if its sharp coeficient is at least K. Your task is to find the maximal number of continuous “cool” teeth Little Imp has.
Input
The first line contains two integers N and K separated by a single space. The following line contains N integers \(\mathbf{A_1}, \mathbf{A_2}, \ldots, \mathbf{A_N}\) separated by single spaces.
Output
The maximal number of continuous “cool” teeth.
Constraints
\(1 \le \mathbf{N} \le 10^5\),
\(1 \le \mathbf{K} \le 10^9\),
\(1 \le \mathbf{A_i} \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 7 4 7 1 4 7 6 3 4 | 3 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
Teeth - Editorial
Go over the array from left to right and keep \(cur\), the number of consecutive elements greater than or equal to \(k\) ending at this position inclusive. If the next element \(x \ge k\), \(cur\) increases by one; otherwise \(cur\) becomes zero. The answer is the maximum of the values of \(cur\) over all positions of the array.
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|