Updates on a tree

Revision en2, by Jeffin, 2021-02-09 18:54:40

Hi! I want to perform the following kind of update and query on a tree. Let all edges in the tree have unit weight and let all vertices store some value. Let this value be 0 initially.

Update:u v d which means that all nodes within a distance of d from u need to be increased by v. Query: v returns value stored in v.

I know basic applications of hld and centroid decomposition but I'm unable to use any of them for this problem. Could you guys pls help me out?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Jeffin 2021-02-09 18:54:40 2 Tiny change: ' on a tree, Let all e' -> ' on a tree. Let all e'
en1 English Jeffin 2021-02-09 18:53:53 485 Initial revision (published)