atcoder#ARC145E. [ARC145E] Adjacent XOR
[ARC145E] Adjacent XOR
Score : points
Problem Statement
You are given two sequences, each of length , consisting of non-negative integers: and .
Determine whether it is possible to make equal to by performing the operation below at most times. If it is possible, present a specific sequence of operations that achieves it.
- Choose an integer . For every integer , simultaneously replace the value of with .
Here, denotes bitwise .
What is bitwise $\mathrm{XOR}$?
The bitwise of non-negative integers and , , is defined as follows:
- When is written in base two, the digit in the 's place () is if exactly one of the digits in that place of and are , 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
If it is impossible to make equal to in at most operations, print No
. If it is possible, print a sequence of operations that achieves it in the following format, where is the number of operations, and is the integer chosen in the -th operation:
Yes
If multiple solutions exist, any of them will be accepted.
3
1 2 0
1 2 3
Yes
2
2 3
In this output, the sequence is changed as follows:
- Initially: .
- After the -st operation: .
- After the -nd operation: .
After the two operations, and are equal, achieving the objective.
2
10 100
1 0
No
2
1152921504606846975 0
1152921504606846975 0
Yes
0