Approach hintTry it first, then revealHide
Queries do not modify the array, so only their effect on the total matters. Prefix sums remove a segment's contribution in O(1); add the replacement value times the segment length and check the parity.
Queries do not modify the array, so only their effect on the total matters. Prefix sums remove a segment's contribution in O(1); add the replacement value times the segment length and check the parity.