#P9033. XOR Sequence Construction
XOR Sequence Construction
XOR Sequence Construction
Given three integers (n), (m), and (k), construct a sequence (a_1,a_2,\dots,a_n) of non-negative integers satisfying:
1. For every (1 \le i \le n), (0 \le a_i \le m).
2. (a_1 \oplus a_2 \oplus \dots \oplus a_n = k), where (\oplus) denotes the bitwise XOR operation.
If no such sequence exists, output -1.
inputFormat
Input consists of three integers (n), (m), and (k) provided on a single line.
outputFormat
If a valid sequence exists, output the (n) numbers (a_1,a_2,\dots,a_n) separated by spaces. Otherwise, output -1.
sample
1 5 3
3