9555: ABC240 —— C - Jumping Takahashi
[Creator : ]
Description
Takahashi is standing at the coordinate $0$ on a number line.
He will now perform $N$ jumps. In the $i$-th jump $(1 \leq i \leq N)$, he moves $a_i$ or $b_i$ in the positive direction.
Is it possible for him to be at the coordinate $X$ after $N$ jumps?
He will now perform $N$ jumps. In the $i$-th jump $(1 \leq i \leq N)$, he moves $a_i$ or $b_i$ in the positive direction.
Is it possible for him to be at the coordinate $X$ after $N$ jumps?
Input
Input is given from Standard Input in the following format:
```
$N$ $X$
$a_1$ $b_1$
$\vdots$
$a_N$ $b_N$
```
```
$N$ $X$
$a_1$ $b_1$
$\vdots$
$a_N$ $b_N$
```
Output
If it is possible for Takahashi to be at the coordinate $X$ after $N$ jumps, print `Yes`; otherwise, print `No`.
Constraints
- $1 \leq N \leq 100$
- $1 \leq a_i \lt b_i \leq 100 \, (1 \leq i \leq N)$
- $1 \leq X \leq 10000$
- All values in input are integers.
- $1 \leq a_i \lt b_i \leq 100 \, (1 \leq i \leq N)$
- $1 \leq X \leq 10000$
- All values in input are integers.
Sample 1 Input
2 10
3 6
4 5
Sample 1 Output
Yes
By moving $b_1(=6)$ in the first jump and $a_2(=4)$ in the second jump, he can be at the coordinate X(=10).
Sample 2 Input
2 10
10 100
10 100
Sample 2 Output
No
He can be at the coordinate X(=10) after the first jump, but not after all jumps.
Sample 3 Input
4 12
1 8
5 7
3 4
2 6
Sample 3 Output
Yes