Tree and Queries
CodeChefOpen on judge ↗
You are given a rooted tree with N nodes. Tree is rooted at node 1. Each node of the tree contains some value. Initially value of each node will be given. You are given Q queries. Queries can be of two types, type U and type Q. - Type U: This query is represented by U x v, which means that you have to add value v to node x. - Type Q: This query is represented by Q x, which means that you have
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