6

Help needed for a problem based on Subtree Queries on tree

 2 years ago
source link: http://codeforces.com/blog/entry/97116
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

By _Enginor_, history, 96 minutes ago,

Link To Problem

Can anyone give some ideas about how can this problem be solved using Segment Trees OR any other data structure.

I build an euler tour of the tree in which each node is pushed twice.Then the subtree of any node is a range in the euler tour array. Now I want an idea about what to store at each node in segment tree and how to perform merge operation.

I have already spent more than 3 hours on this problem but I could not figure out any approach. Also I am unable to understand the editorial given :(.

Any help is appreciated !.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK