Editorial for Canada Day Contest 2021 - 0-1
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Chapter 1
There are
For Subtask 1, use dynamic programming. Let
For Subtask 2, generate a matrix
Chapter 2
Solution by
You can do an xor convolution of
To solve Subtask 4, use the Fast Walsh–Hadamard transform to speed up the xor convolutions and find the answer in
Chapter 3
Next, you'll need to return to the matrix technique from subtask 2. But this time, you have an algorithm with a complexity of
Bonus: Even now you can take advantage of symmetries in the matrix for constant time improvements.
Comments