#abc250e. E - Prefix Equality
E - Prefix Equality
Score : points
问题描述
你已知两个整数序列 和 ,每个序列的长度均为 。
对于 ,以以下格式回答查询:
- 如果在 序列的前 项 中包含的值集合与在 序列的前 项 中包含的值集合相等,则输出
Yes
;否则,输出No
。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given integer sequences and , each of length .
For , answer the query in the following format.
- If the set of values contained in the first terms of , , and the set of values contained in the first terms of , , are equal, then print
Yes
; otherwise, printNo
.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the response to the -th query.
Sample Input 1
5
1 2 3 4 5
1 2 2 4 3
7
1 1
2 2
2 3
3 3
4 4
4 5
5 5
Sample Output 1
Yes
Yes
Yes
No
No
Yes
No
Note that sets are a concept where it matters only whether each value is contained or not.
For the -rd query, the first terms of contain one and one , while the first terms of contain one and two 's. However, the sets of values contained in the segments are both , which are equal.
Also, for the -th query, the values appear in different orders, but they are still equal as sets.
update @ 2024/3/10 10:41:22