atcoder#ABC245C. [ABC245C] Choose Elements
[ABC245C] Choose Elements
Score : points
Problem Statement
You are given two sequences, each of length , consisting of integers: and .
Determine whether there is a sequence of length , , satisfying all of the conditions below.
- or , for every .
- , for every .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If there is an that satisfies all of the conditions, print Yes
; otherwise, print No
.
5 4
9 8 3 7 2
1 6 2 9 5
Yes
satisfies all conditions.
4 90
1 1 1 100
1 2 3 100
No
No satisfies all conditions.
4 1000000000
1 1 1000000000 1000000000
1 1000000000 1 1000000000
Yes