Adjacent exclusive OR (XOR)——相邻的异或(XOR)
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Statement
The XOR operation is a very common operation in computers. For a binary number with only one digit, the XOR operation output is true (1) if and only if the two input values are different, otherwise the output is false (0), that is, ''the same is 0, different is 1".
For some numbers, we have a bitwise exclusive OR operator denoted as , which means converting into binary bits and performing an exclusive OR operation on each bit to get a new number. For example, is calculated as follows:
$$5_{(10)}\oplus9_{(10)}=0101_{(2)}\oplus1001_{(2)}=1100_{(2)}=12_{(10)} $$so we can calculate . In mainstream programming languages, the exclusive OR symbol is generally ^ . For example, in C++, typing int x = a ^ b; means .
In this problem, you are given an array of length . For each index in the array that satisfies , you can perform the following operation at most once[1]:
- The assignment is , where represents the bitwise exclusive OR operation. It should be noted that represents the th number in the array , for example, in the array instead of the base.
You can choose the indices and perform the operations in any order. Given another array of length , determine whether can be transformed into using the operations.
Input
The first line contains an integer ().
The second line contains integers ().
The third line contains integers ().
Output
For each test case, if can be converted to , then output ''Yes'' (without quotes); otherwise, output "No''.
Samples
5
1 2 3 4 5
3 2 7 1 5
Yes
3
0 0 1
1 0 1
No
3
0 0 1
0 0 0
No
4
0 0 1 2
1 3 3 2
No
6
1 1 4 5 1 4
0 5 4 5 5 4
Yes
Notes
In the first example, you can perform the following operations in the following order:
- Choose subscript so that , and becomes ;
- Choose subscript so that , and becomes ;
- Choose subscript so that , and becomes .
From this we can see that can be transformed into .
This refers to performing the operation once per index, not just once globally. For example, you can perform the operation at index and then at index , but you cannot perform the operation at index again. ↩︎
2025 JSUT Collegiate Programming Contest 江苏理工学院新生赛-同步赛
- 状态
- 已结束
- 规则
- ACM/ICPC
- 题目
- 15
- 开始于
- 2025-11-8 12:00
- 结束于
- 2025-11-8 17:00
- 持续时间
- 5 小时
- 主持人
- 参赛人数
- 15