#P12537. [XJTUPC 2025] 罗斯飞鸽

    ID: 12372 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划 DP二分2025O2优化高校校赛

[XJTUPC 2025] 罗斯飞鸽

Description

Awa is participating in a live music game called Gros-Phi. In the event, Awa must appear at a specified location at a specified time.

Specifically, Gros-Phi's activity area is an infinitely long straight line. Gros-Phi has a total of nn scoring points. The ii-th scoring point requires Awa to appear at position xix_i at time tit_i.

Awa's maximum running speed is vv units per moment. At time 00, Awa can choose any position and then start playing Gros-Phi.

Awa wants to know how many scoring points she can reach at most.

Input Format

The first line contains a positive integer TT (1T5×1051\le T \le 5\times 10^5), indicating that Awa played a total of TT games.

For each game, the first line contains two positive integers nn and vv (1n5×1051\le n \le 5\times 10^5, 1v1091 \le v \le 10^9), separated by a space, indicating the number of decision points and the maximum speed of Awa.

The next nn lines, each containing two integers tit_i and xix_i (0ti,xi1090 \le t_i, |x_i| \le 10^9), separated by a space, describe a scoring point. It is guaranteed that there are no two identical scoring points in a game.

It is guaranteed that the sum of nn in TT rounds of games does not exceed 5×1055 \times 10^5.

Output Format

There should be TT lines in total, each line contains one integer, indicating how many scoring points Awa can reach at most in the corresponding game.

3
6 1
8 7
8 -6
10 -8
2 5
7 -9
1 0
6 1
0 -6
0 0
8 2
10 -8
9 -5
2 -9
6 1
7 4
8 -4
8 9
3 -9
1 0
7 2
3
2
2

Hint

Since the input and output data of this question are large, it is recommended to use a faster input and output method, such as scanf\tt{scanf} and printf\tt{printf}.