#abc245c. C - Choose Elements
C - Choose Elements
Score : points
问题描述
给定两个长度均为 的整数序列: 和 。
确定是否存在一个长度为 的序列 ,满足以下所有条件:
-
对于每个 ,有 或者 。
-
对于每个 ,满足 。
以上为通义千问 qwen-max 翻译,仅供参考。
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
.
Sample Input 1
5 4
9 8 3 7 2
1 6 2 9 5
Sample Output 1
Yes
satisfies all conditions.
Sample Input 2
4 90
1 1 1 100
1 2 3 100
Sample Output 2
No
No satisfies all conditions.
Sample Input 3
4 1000000000
1 1 1000000000 1000000000
1 1000000000 1 1000000000
Sample Output 3
Yes
update @ 2024/3/10 10:31:15