← All problemsSign in

Tree Fun

CodeChefRating 2714Open on judge ↗

David is a computer science student who loves his future profession. He is one of those who think that trees grow down, not up. David likes connected undirected acyclic graphs, also known as trees. He especially likes solving problems about trees. Recently David found a piece of paper with a tree with N vertices drawn on it. He also found M queries on the same piece of paper, where each query wa

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