Root Fruit
CodeChefOpen on judge ↗
Given a graph with $N$ nodes and $N - 1$ edges. Every node has a value given by array $Val$. You are given $Q$ queries. In each query, two integers $V$ and $X$ are given. For a given $X$, find the maximum value when $X$ is xor'ed with node value that occurs in the path from vertex $V$ to root. **Note:** It is guaranteed that given graph is a tree. Take root of the tree as **1**. ### Input
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