#6696. [ICPC 2025 Xi'an R] Killing Bits
[ICPC 2025 Xi'an R] Killing Bits
[ICPC 2025 Xi'an R] Killing Bits
题目描述
You are given two arrays $a$ and $b$, both consisting of $n$ non-negative integers. You can perform the following operation on the array $a$ an arbitrary number of times (possibly, zero):- First, you select a permutation of ;
- Then, for each , you set to . Here, denotes the bitwise AND operation.
You have to determine whether it is possible to transform into .
输入格式
The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 10^4$), the number of test cases. For each test case:- The first line contains a single integer (), which is the length of arrays and .
- The second line contains integers (), which are the elements of .
- The third line contains integers (), which are the elements of .
It is guaranteed that the sum of over all test cases does not exceed .
输出格式
For each test case, print $\texttt{Yes}$ in a single line if it is possible to transform $a$ into $b$. Otherwise, print $\texttt{No}$.You can output the answer in any case (upper or lower). For example, the strings , , , and will be recognized as positive responses.
4
3
0 1 2
2 1 0
5
1 0 1 3 4
0 0 1 1 4
8
1 2 3 4 5 6 7 7
1 2 3 4 5 6 7 7
8
7 7 7 7 7 7 7 7
1 2 3 4 5 6 7 7
No
Yes
Yes
No
提示
In the first test case, we need to use at least one operation to transform $a$ into $b$. Note that $a_1 \operatorname{\&} p_1$ is always $0$ because $a_1 = 0$. However, $b_1>0$, so it is impossible to make $a_1 = b_1$, no matter how the permutations are selected during the operations.In the second test case, you can select . After this operation, is transformed into .
In the third test case, , so we do not need any operations. 标签: P14457|2025|网络流|Special Judge|ICPC|西安