Queries On Tree
You are given a tree of N nodes numbered from 1 to N. The ith edge connecting node ui and vi has a weight of wi. Your target is to handle the queries of the following two types: - "1 i c" : Update the weight of ith edge with the new weight c. (1 represents the query type). - "2 u v" : Find the length of the path from node u to v. (2 represents the query type). Input - The first line c
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