Public Judge

pjudge

حد الوقت: 3 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#21663. 【PR #7】Dudu and DUDU

الإحصائيات

DUDU is a cute little bear who loves to eat the honey of the farmer Dudu. Therefore, Dudu wants to build a rectangular fence to enclose all the honey points, thereby keeping DUDU out.

Specifically, Dudu has $n$ honey points, which are $(x_1, y_1), (x_2, y_2), \dots, (x_n, y_n)$ in order. The fence is always a rectangle at any time. Suppose the fence is located at $(X, Y)$; a point $(x_i, y_i)$ is inside the rectangle if and only if $x_i \leq X$ and $y_i \leq Y$. Since the construction process cannot be known by DUDU, Dudu must build the fence according to specific rules!

We need to perform rounds of expansion until our fence encloses all honey points. Suppose the current fence is at $(X, Y)$. During an expansion, we choose a point $(x_j, y_j)$ that is not inside the fence, and then we expand the fence to $(\max(X, x_j), \max(Y, y_j))$. Let $A = \max(X, x_j)$ and $B = \max(Y, y_j)$. DUDU has a detection value $m$, so this expansion must also satisfy the condition that the perimeter of the fence at $(A, B)$ minus the common part between $(A, B)$ and $(X, Y)$ does not exceed $m$. The detailed explanation is as follows:

  • If $X = A$, then $2(B - Y) + X \leq m$.
  • If $Y = B$, then $2(A - X) + Y \leq m$.
  • Otherwise, $2A + 2B - X - Y \leq m$.

Determine whether Dudu has an expansion plan. There are multiple test cases.

Input

The first line contains a positive integer $T$.

For each test case, the first line contains two integers $n$ and $m$.

The next $n$ lines each contain two positive integers $x, y$, representing one of the honey points.

Output

For each test case, output a single line containing Yes or No indicating whether an expansion plan exists.

Examples

Input 1

3
3 6
1 1
4 1
2 2
4 9
1 4
2 3
3 2
4 1
10 14
10 8
1 6
2 5
4 2
5 5
8 9
2 7
6 8
6 5
7 4

Output 1

Yes
No
Yes

Constraints

For all data, $x, y \leq 10^9$, $m \leq 4 \times 10^9$, $\sum n \leq 5 \times 10^5$. Let $L$ be the maximum value of $n$ across all test cases, $S = \sum n^2$, and $H = \sum n^3$.

| :---: | :---: | :---: | :---: | :---: | | Subtask ID | $L \leq$ | $S \leq$ | $H \leq$ | Score | | $1$ | $1000$ | $1.25 \times 10^7$ | $1.25 \times 10^7$ | $20$ | | $2$ | | $5 \times 10^7$ | $1.25 \times 10^{17}$ | $30$ | | $3$ | $5 \times 10^5$ | $2.5 \times 10^{11}$ | | $50$ |

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.