Codeforces Global Round 24 |
---|
Finished |
Doremy has two arrays $$$a$$$ and $$$b$$$ of $$$n$$$ integers each, and an integer $$$k$$$.
Initially, she has a number line where no integers are colored. She chooses a permutation $$$p$$$ of $$$[1,2,\ldots,n]$$$ then performs $$$n$$$ moves. On the $$$i$$$-th move she does the following:
Determine if the integer $$$k$$$ can be colored with color $$$1$$$.
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1\le t\le 10^4$$$) — the number of test cases. The description of the test cases follows.
The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le k \le 10^9$$$).
Each of the following $$$n$$$ lines contains two integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \le a_i,b_i \le 10^9$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output "YES" (without quotes) if the point $$$k$$$ can be colored with color $$$1$$$. Otherwise, output "NO" (without quotes).
You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response).
64 165 38 1210 715 14 168 1210 715 15 34 1610 715 15 38 124 1615 15 38 1210 71 1000000000500000000 5000000002 10000000001 9999999991 1
NO YES YES YES NO YES
For the first test case, it is impossible to color point $$$16$$$ with color $$$1$$$.
For the second test case, $$$p=[2,1,3,4]$$$ is one possible choice, the detail is shown below.
For the third test case, $$$p=[2,1,4,3]$$$ is one possible choice.
For the fourth test case, $$$p=[2,3,4,1]$$$ is one possible choice.
Name |
---|