[Solution] Or Permutation CodeChef Solution | CodeChef Problem Solution 2022
Chef has a sequence of integers. He picked a non-negative integer and obtained another sequence of integers, defined as for each . Unfortunately, he forgot , and the sequence got jumbled.
Chef wonders what the value of is. He gives you the sequence and the jumbled sequence . Your task is to find whether there is a non-negative integer such that there exists a permutation of satisfying the condition for each .
Solution Click Below:- CLICK HERE
If there are multiple such , find any of them.
Note: Here represents the bitwise OR operation.
Input Format
- The first line of the input contains a single integer, , denoting the number of test cases. The description of test cases follows.
- Each test case consists of lines of input.
- The first line of each test case contains a single integer .
- The second line of each test case contains space-separated integers, denoting the sequence .
- The third line of each test case contains space-separated integers, denoting the sequence .
Output Format
- For each test case, output on a new line a single non-negative integer that satisfies the given condition. If there is no such , print instead.
Constraints
- for each
- The sum of over all test cases doesn't exceed
No comments:
Post a Comment