Bitwise Tour
CodeChefOpen on judge ↗
Given a rooted tree with $N$ vertices labeled $1$ through $N$, the root being $1$ and each node containing a value $A_i$, you're to process $Q$ queries of the following type(s): - $1\ u\ w$: Update the value of node **u** to **w**. - $2\ u$: Print the absolute difference $|AND(u) - OR(T - u)|$, where $AND(u)$ is bitwise AND of all node values in the subtree rooted at node **u**, and $OR(T - u)
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start