← All problemsSign in

X AND Y Tree

CodeChefRating 2291Open on judge ↗

Chef has a tree consisting of $N$ nodes, rooted at node $1$. Every node of this tree can be assigned a binary value $(0$ or $1)$. **Initially, every node is assigned 0.** - We define **AND-value** of a set of nodes as the [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of all the values of the nodes in it. - An edge in the tree is called **good**, if after removing this edge,

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start