#abc367f. F - Rearrange Query
F - Rearrange Query
Score : points
问题陈述
你得到了两个正整数序列,长度为 : 和 。
你需要按顺序处理 个查询。第 个查询如下所述。
- 你得到了正整数 。如果能够将子序列 重新排列以匹配子序列 ,则打印
Yes
,否则打印No
。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given sequences of positive integers of length : and .
You are given queries to process in order. The -th query is explained below.
- You are given positive integers . Print
Yes
if it is possible to rearrange the subsequence to match the subsequence , andNo
otherwise.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer to the -th query.
Sample Input 1
5 4
1 2 3 2 4
2 3 1 4 2
1 3 1 3
1 2 3 5
1 4 2 5
1 5 1 5
Sample Output 1
Yes
No
No
Yes
- For the 1st query, it is possible to rearrange to match . Hence, we print
Yes
. - For the 2nd query, it is impossible to rearrange in any way to match . Hence, we print
No
. - For the 3rd query, it is impossible to rearrange in any way to match . Hence, we print
No
. - For the 4th query, it is possible to rearrange to match . Hence, we print
Yes
.
Sample Input 2
4 4
4 4 4 4
4 4 4 4
1 2 2 3
3 3 1 1
1 3 1 4
1 4 2 3
Sample Output 2
Yes
Yes
No
No