Problem 1787 · Hard

Make the XOR of All Segments Equal to Zero

Every window of length k must xor to zero, so each index class mod k holds one value; a DP over xor states chooses the cheapest value per class.

Open the interactive visualisation