How to use segment trees on rooted trees?

Правка en1, от WalidMasri, 2016-01-30 18:46:17

Hello CodeForces!

I have the following problem : Given a rooted tree, i have 2 types of queries: 1 q : Mark the Node q colored/uncolored. (Initially they are all uncolored). 2 p : Get the sum of the colored nodes in the p-subtree.

How can i solve this problem using segmentTrees? I couldn't figure out the part where i need to transform my rooted tree into an array, how to do that as well?

Thanks!

Теги segment tree, trees, queries on tree

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский WalidMasri 2016-01-30 18:46:17 497 Initial revision (published)