← All problemsSign in

Updating Edges on Trees

CodeChefRating 2806Open on judge ↗

You have a tree consisting of N vertices numbered 1 to N. Initially each edge has a value equal to zero. You have to first perform M1 operations and then answer M2 queries. Note you have to first perform all the operations and then answer all queries after all operations have been done. Operations are defined by: A B C D: On the path between nodes numbered A and B increase the value of each ed

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