atcoder#ABC150F. [ABC150F] Xor Shift
[ABC150F] Xor Shift
Score : points
Problem Statement
Given are two sequences and of non-negative integers each.
Snuke will choose an integer such that and an integer not less than , to make a new sequence of length , , as follows:
Find all pairs such that will be equal to .
What is $\text{ XOR }$?
The XOR of integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if either or , but not both, has in the 's place, and otherwise.
For example, . (In base two: .)
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print all pairs such that and will be equal, using one line for each pair, in ascending order of (ascending order of for pairs with the same ).
If there are no such pairs, the output should be empty.
3
0 2 1
1 2 3
1 3
If ,
and we have .
5
0 0 0 0 0
2 2 2 2 2
0 2
1 2
2 2
3 2
4 2
6
0 1 3 7 6 4
1 5 4 6 2 3
2 2
5 5
2
1 2
0 0
No pairs may satisfy the condition.