Xenia and Bit Operations
MediumRating 1700CodeforcesSegment Tree & Fenwick Tree
Approach hintTry it first, then revealHide
The process is a segment tree whose levels alternate between OR and XOR, starting with OR just above the leaves. Store each node's operation by level and recompute only the path to the root after each update.