CF1704B.Luke is a Foodie

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Luke is a Foodie

Luke likes to eat. There are nn piles of food aligned in a straight line in front of him. The ii-th pile contains aia_i units of food.

Luke will walk from the 11-st pile towards the nn-th pile, and he wants to eat every pile of food without walking back. When Luke reaches the ii-th pile, he can eat that pile if and only if vaix|v - a_i| \leq x, where xx is a fixed integer, and vv is Luke's food affinity.

Before Luke starts to walk, he can set vv to any integer. Also, for each ii (1in1 \leq i \leq n), Luke can change his food affinity to any integer before he eats the ii-th pile.

Find the minimum number of changes needed to eat every pile of food.

Note that the initial choice for vv is not considered as a change.

Input

The input consists of multiple test cases. The first line contains a single integer tt (1t1041 \leq t \leq 10^4) — the number of test cases. The description of test cases follows.

For each test case, the first line contains two integers, n,xn, x (1n21051 \leq n \leq 2 \cdot 10^5, 1x1091 \leq x \leq 10^9) — the number of piles, and the maximum difference between the size of a pile and Luke's food affinity, such that Luke can eat the pile.

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots , a_n (1ai1091 \leq a_i \leq 10^9).

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case, output an integer on a separate line, which is the minimum number of changes needed.

Note

In the first test case, Luke can set vv to 55 before he starts to walk. And he can walk straight to eat every piles of food without changing vv.

In the second test case, Luke can set vv to 33 before he starts to walk. And he could change vv to 1010 before he eats the second pile. After that, he can walk straight to eat remaining food without changing vv.

In the fourth test case, Luke can set vv to 33 before he starts to walk. And he could change vv to 88 before he eats the sixth pile. After that, he can walk straight to eat remaining food without changing vv.

In the fifth test case, Luke can set vv to 44 before he starts to walk. And he could change vv to 66 before he eats the fourth pile. Then he could change vv to 1212 before he eats the seventh pile. After that, he can walk straight to eat remaining food without changing vv.

Samples

7
5 3
3 8 5 6 7
5 3
3 10 9 8 7
12 8
25 3 3 17 8 6 1 16 15 25 17 23
10 2
1 2 3 4 5 6 7 8 9 10
8 2
2 4 6 8 6 4 12 14
8 2
2 7 8 9 6 13 21 28
15 5
11 4 13 23 7 10 5 21 20 11 17 5 29 16 11
0
1
2
1
2
4
6

在线编程 IDE

建议全屏模式获得最佳体验