Tree Magic
CodeChefOpen on judge ↗
So today a problem on a weighted undirected tree was given to Lakshay in class, where he is given a weighted undirected tree with $N$ nodes. Every edge of the tree has some weight assigned to it. He is also given two integers $C$ and $src$ and he has to find the *minimum* value of the given Magic function : Magic Function : $\Sigma^{n}_{i=1} dist(src,i)$ , where $dist(src,i)$ represents the su
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