#abc355b. B - Piano 2
B - Piano 2
Score : points
问题陈述
给定一个长度为 的序列 和一个长度为 的序列 。这里, 和 的所有元素都是两两不同的。确定通过将 和 的所有元素按升序排列形成的序列 是否包含两个连续的元素出现在 中。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given a sequence of length and a sequence of length . Here, all elements of and are pairwise distinct. Determine whether the sequence formed by sorting all elements of and in ascending order contains two consecutive elements appearing in .
Constraints
- are distinct.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
If contains two consecutive elements appearing in , print Yes
; otherwise, print No
.
Sample Input 1
3 2
3 2 5
4 1
Sample Output 1
Yes
. Since and from occur consecutively in , print Yes
.
Sample Input 2
3 2
3 1 5
4 2
Sample Output 2
No
. Since no two elements from occur consecutively in , print No
.
Sample Input 3
1 1
1
2
Sample Output 3
No