← All problemsSign in

Weasel does Xor on Tree

CodeChefRating 2508Open on judge ↗

A tree is an undirected graph in which each pair of vertices is connected to each other by exactly one path. Weasel has a tree with N nodes. The indexing of the nodes is 0-based and the tree is rooted at node 0. Every node i has an initial value X0i. Every day d > 0, he performs the following operations, starting from the root: - Weasel computes Xdu as the bitwise-xor sum of all the values Xd

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