题目描述
Problem Description
You are given natural numbers $N$ and $X$, and a sequence $(a_1, a_2, \ldots, a_N)$ as input. Some of the $a_i$ are missing. It is known that the missing $a_i$ are in the range $0 \leq a_i \leq X$.
Restore the sequence so that it satisfies:
$a_1 \text{ XOR } a_2 \text{ XOR } \cdots \text{ XOR } a_N = X$
XOR is defined as the bitwise exclusive OR of integers $A$ and $B$. The result $X$ is defined as follows:
- In the binary representation of $X$, the digit at the $2^k$ (for $k \geq 0$) position is 1 if only one of the digits at the $2^k$ position in the binary representations of $A$ and $B$ is 1; otherwise, it is 0.
For example, $3 \text{ XOR } 5 = 6$ (in binary: $011 \text{ XOR } 101 = 110$).
Input Format
The input is given from the standard input in the following format:
$N$ $X$ $a_1$ $a_2$ $\ldots$ $a_N$
Output Format
Output one sequence that satisfies the condition. If no such sequence exists, output -1.
Sample Input and Output
Sample Input #1
4 11
8 -1 1 5
Sample Output #1
8 7 1 5
Sample Input #2
6 7
-1 2 -1 4 -1 6
Sample Output #2
1 2 3 4 5 6
Sample Input #3
1 2
3
Sample Output #3
-1
Notes/Hints
Constraints
- All input values are integers.
- $1 \leq N \leq 5 \times 10^5$
- $0 \leq X \leq 10^9$
- $-1 \leq a_i \leq 10^9$
$a_i = -1$ means the information is missing.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分