Final Problem
CodeChefOpen on judge ↗
# Final Problem The final problem give is: Given a tree with 'N' nodes and each node has some cost Ai. Now, you must perform N-1 queries on this tree in such a manner that in each query: • You must permanently delete edge e from the tree. • After deleting that edge e, you must count and print the total no. of unordered pairs (u, v) such that there exists a path from u to v and | Au -
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