Updates on a tree

Правка en2, от 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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Jeffin 2021-02-09 18:54:40 2 Tiny change: ' on a tree, Let all e' -> ' on a tree. Let all e'
en1 Английский Jeffin 2021-02-09 18:53:53 485 Initial revision (published)