MINIKILL - ENIGMA! EDITORIAL PLEASE!

thanks bro…nice trick :heart_eyes:

1 Like

In which type of question this trick is applied?
Any more question where this trick is used so that We can understand more clearly
thanks for sharing this trick.

1 Like

Basically ulta bfs karke you calculate the sum? Kya mai theek samjha?

1 Like

Yes, right .
And about problems, I have used it at too many places, 1-hard problem from August-Long, 3rd problem of round-E Google-Kickstart,4th problem of recent Div2-contest(Numbers on tree). Many variations on this technique are possible which can make one fall in love with it.

1 Like

can you provide links to some questions for dp on trees

Can you provide 1-2 ques and link of your solution…for better understanding…

There’s a blog on Codeforces about it, I recommend you read that for more problems on dp on trees.

1 Like

Can you please share your code for this approach

@ anon55659401
what if tree is like this?

image

node: 2 and node: 3 will have 0
hence node 1 = 0.

Though my first approach was this itself but getting WA.