Boht tej ho rahe ho, hein!
CodeChefOpen on judge ↗
"Why don't you have problems on Trees in Convex Hull?" Fachin always keeps asking us to give problems on trees. We gave him the question of finding the center of a node-weighted tree, but he misunderstood the question and solved the following problem: Given a tree on $N$ nodes with weights $w_i$ on the $i^{\text{th}}$ node, find the vertex $v$ such that the sum of weighted distances from $v$ to a
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