| CodeSmash 2021 by RAPL |
|---|
| Finished |
Assume we have an array $$$a$$$ of size $$$m$$$ indexed from 1 to $$$m$$$ and an integer $$$k$$$. Then we will make the array $$$b$$$ (which is initially empty) by the following procedure:
1. Sort the array $$$a$$$ in non-decreasing order.
2. Append $$$a_{i+1}$$$ - $$$a_i$$$ to $$$b$$$ for each $$$i$$$ from 1 to $$$m$$$-1.
We will call the array $$$\bf{a}$$$ good if the minimum element of the array $$$\bf{b}$$$ is at least $$$k$$$.
Now the actual problem, given an array $$$c$$$ of size $$$n$$$ and the integer $$$k$$$, count the number of good subarrays of $$$c$$$ of size at least 2.
The input consists of multiple test cases. The first line contains an integer $$$t$$$ $$$(1 \leq t \leq 10^{5})$$$ - the number of test cases. The descriptions of the test cases follow.
The first line of each test case contains two integers $$$n$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{5}, 1 \leq k \leq 10^{9})$$$.
The following line contains $$$n$$$ space-separated positive integers $$$a_1, a_2, .. , a_n$$$ $$$(1 \leq a_i \leq 10^{9})$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^{5}$$$.
For each test case, output the number of good subarrays of $$$c$$$ of size at least 2.
67 37 2 5 3 1 1 53 428 6 282 110 87 215 15 6 11 12 12 115 55 4 1 3 144 49 6 10 12
3 2 1 3 1 1
| Name |
|---|


