atcoder#AGC057C. [AGC057C] Increment or Xor
[AGC057C] Increment or Xor
Score : points
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 $\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 and is , and otherwise.
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.
3
5 0 3 6 1 4 7 2
Yes
4
-1 6 -1 1
The sequence of operations above changes the sequence as follows.
- Initially:
- Operation :
- Operation ():
- Operation :
- Operation ():
3
2 5 4 3 6 1 0 7
No
No sequence of operations achieves the objective.
3
0 1 2 3 4 5 6 7
Yes
0
Performing zero operations achieves the objective. Whether an empty line is printed or not does not affect the verdict.