#agc057c. [agc057_c]Increment or Xor
[agc057_c]Increment or Xor
Problem Statement
You are given a positive integer and a sequence of terms, where each is an integer between and (inclusive) and holds if .
You can perform the following two kinds of operations on :
- Operation : For every , change to .
- Operation : Choose an integer between and . For every , change to .
Here, denotes bitwise .
What is bitwise ?
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 and is , and otherwise.
For example, we have (in base two: ).
Your objective is to make for every . Determine whether it is achievable. It can be proved that, under the Constraints of this problem, one can achieve the objective with at most operations if it is achievable at all. Print such a sequence of operations.
Constraints
- , if
Input
Input is given from Standard Input in the following format:
Output
If it is possible to make for every , print Yes
; otherwise, print No
.
In the case of Yes
, it should be followed by a sequence of operations that achieves the objective, in the following format:
Here, is a non-negative integer representing the number of operations, which must satisfy ; is an integer representing the -th operation, which should be set as follows.
- If the -th operation is Operation , .
- If the -th operation is Operation , should be the integer chosen in that operation.
If there are multiple possible solutions, you may print any of them.
Sample Input 1
3
5 0 3 6 1 4 7 2
Sample Output 1
Yes
4
-1 6 -1 1
The sequence of operations above changes the sequence as follows.
- Initially:
- Operation :
- Operation ():
- Operation :
- Operation ():
Sample Input 2
3
2 5 4 3 6 1 0 7
Sample Output 2
No
No sequence of operations achieves the objective.
Sample Input 3
3
0 1 2 3 4 5 6 7
Sample Output 3
Yes
0
Performing zero operations achieves the objective. Whether an empty line is printed or not does not affect the verdict.