atcoder#ABC245E. [ABC245E] Wrapping Chocolate
[ABC245E] Wrapping Chocolate
Score : points
Problem Statement
Takahashi has pieces of chocolate. The -th piece has a rectangular shape with a width of centimeters and a length of centimeters. He also has boxes. The -th box has a rectangular shape with a width of centimeters and a length of centimeters.
Determine whether it is possible to put the pieces of chocolate in the boxes under the conditions below.
- A box can contain at most one piece of chocolate.
- and must hold when putting the -th piece of chocolate in the -th box (they cannot be rotated).
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to put the pieces of chocolate in the boxes, print Yes
; otherwise, print No
.
2 3
2 4
3 2
8 1 5
2 10 5
Yes
We can put the first piece of chocolate in the third box and the second piece in the first box.
2 2
1 1
2 2
100 1
100 1
No
A box can contain at most one piece of chocolate.
1 1
10
100
100
10
No
1 1
10
100
10
100
Yes