Tree and Queries - Editorial

Problem link : contest
practice

Difficulty : Easy - Medium

Pre-requisites : graphs, trees, in order

Solution :

This kind of problems are very standard. You can have a look at following problem and a very nicely written editorial of elfus0.

Unfortunately test data was weak which led to passing of unoptimized solution. We will update the test cases soon.

Setter’s solution: link

2 Likes

Is setter’s solution correct? If a node value turns 0 to something else this solution does not update the bit with -1.