Nuttela loves trees

Problem : https://www.codechef.com/ENAU2019/problems/ENS1

Pls share approach for the above problem

1)Flatten the tree using Euler Tour of the tree into an array .
2)Now use segment tree operations on the array to answer each query in O(logN) time.

1 Like

can u share your solution

Karan bro can you help me in a problem?

Will upload the editorial of this problem by tonight.

1 Like

editorial ??..@nuttela

Nuttela Loves Trees - Editorial