Codeforces Round 453 (Div. 2)
A
Visiting a Friend
Codeforces
1100
原题
←B →
翻译中…

Pig is visiting a friend.

翻译中…

Pig's house is located at point $0$, and his friend's house is located at point $*m*$ on an axis.

翻译中…

Pig can use teleports to move along the axis.

翻译中…

To use a teleport, Pig should come to a certain point (where the teleport is located) and choose where to move: for each teleport there is the rightmost point it can move Pig to, this point is known as the limit of the teleport.

翻译中…

Formally, a teleport located at point $*x*$ with limit $*y*$ can move Pig from point $*x*$ to any point within the segment $[*x*; *y*]$, including the bounds.

翻译中…

image

翻译中…

Determine if Pig can visit the friend using teleports only, or he should use his car.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$ and $*m*$ ($1 ≤ *n* ≤ 100, 1 ≤ *m* ≤ 100$) — the number of teleports and the location of the friend's house.

翻译中…

The next $*n*$ lines contain information about teleports.

翻译中…

The $*i*$-th of these lines contains two integers $*a*_{*i*}$ and $*b*_{*i*}$ ($0 ≤ *a*_{*i*} ≤ *b*_{*i*} ≤ *m*$), where $*a*_{*i*}$ is the location of the $*i*$-th teleport, and $*b*_{*i*}$ is its limit.

翻译中…

It is guaranteed that $*a*_{*i*} ≥ *a*_{*i* - 1}$ for every $*i*$ ($2 ≤ *i* ≤ *n*$).

翻译中…

Output

翻译中…

Print "YES" if there is a path from Pig's house to his friend's house that uses only teleports, and "NO" otherwise.

翻译中…

You can print each letter in arbitrary case (upper or lower).

翻译中…

Note

翻译中…

The first example is shown on the picture below:

翻译中…

image

翻译中…

Pig can use the first teleport from his house (point $0$) to reach point $2$, then using the second teleport go from point $2$ to point $3$, then using the third teleport go from point $3$ to point $5$, where his friend lives.

翻译中…

The second example is shown on the picture below:

翻译中…

image

翻译中…

You can see that there is no path from Pig's house to his friend's house that uses only teleports.

翻译中…

样例

Input #1
3 5
0 2
2 4
3 5
Output #1
YES
InputCopy OutputCopy
Input #2
3 7
0 4
2 5
6 7
Output #2
NO
InputCopy OutputCopy
题目信息
题号
902A
时间限制
1 s
内存限制
256 MB
标签
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。