[Solution] The XOR-OR Dilemma CodeChef Solution
Chef has an array of length such that .
In one operation, Chef can pick any two elements of the array, delete them from , and append either their bitwise XOR or their bitwise OR to .
Note that after each operation, the length of the array decreases by .
Let be the final number obtained after operations are made. You are given an integer , determine if you can get via some sequence of operations.
In case it is possible to get , print the operations too (see the section Output format for more
details), otherwise print .
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of a single line containing two space-separated integers and .
Output Format
For each test case, output if it is impossible to get in the end. Otherwise print lines denoting the operations.
On each line, print
- if you want replace and with .
- if you want replace and with .
Note that and are the elements of the array at the time of applying the operation, and if either of them is not present in the array you will receive a WA verdict.
Constraints
- The sum of over all test cases won't exceed
No comments:
Post a Comment