Codeforces Round 799 (Div. 4) |
---|
Finished |
Given an array $$$a$$$ of length $$$n$$$ and an integer $$$k$$$, find the number of indices $$$1 \leq i \leq n - k$$$ such that the subarray $$$[a_i, \dots, a_{i+k}]$$$ with length $$$k+1$$$ (not with length $$$k$$$) has the following property:
The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases.
The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$3 \leq n \leq 2 \cdot 10^5$$$, $$$1 \leq k < n$$$) — the length of the array and the number of inequalities.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the elements of the array.
The sum of $$$n$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output a single integer — the number of indices satisfying the condition in the statement.
64 220 22 19 845 19 5 3 2 15 29 5 3 2 17 222 12 16 4 3 22 127 322 12 16 4 3 22 129 33 9 12 3 9 12 3 9 12
2 3 2 3 1 0
In the first test case, both subarrays satisfy the condition:
Name |
---|