CF1572B Xor of 3
Description
You are given a sequence $ a $ of length $ n $ consisting of $ 0 $ s and $ 1 $ s.
You can perform the following operation on this sequence:
- Pick an index $ i $ from $ 1 $ to $ n-2 $ (inclusive).
- Change all of $ a_{i} $ , $ a_{i+1} $ , $ a_{i+2} $ to $ a_{i} \oplus a_{i+1} \oplus a_{i+2} $ simultaneously, where $ \oplus $ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)
Find a sequence of at most $ n $ operations that changes all elements of $ a $ to $ 0 $ s or report that it's impossible.We can prove that if there exists a sequence of operations of any length that changes all elements of $ a $ to $ 0 $ s, then there is also such a sequence of length not greater than $ n $ .
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first example, the sequence contains only $ 0 $ s so we don't need to change anything.
In the second example, we can transform $ [1, 1, 1, 1, 0] $ to $ [1, 1, 0, 0, 0] $ and then to $ [0, 0, 0, 0, 0] $ by performing the operation on the third element of $ a $ and then on the first element of $ a $ .
In the third example, no matter whether we first perform the operation on the first or on the second element of $ a $ we will get $ [1, 1, 1, 1] $ , which cannot be transformed to $ [0, 0, 0, 0] $ .