I made a video editorial discussing the intuition behind problem D: The Omnipotent Monster Killer from last Codeforces Round 958. It also talks about a neat trick to analyze the time complexity of Tree DP problems. I also created a practice contest for you to assess your cubic and quadratic solutions.
https://youtu.be/exUm24JN2-A?si=uQsyu0tz571kwinW
Here is the link to the contest https://codeforces.me/group/7Dn3ObOpau/contest/536755
Here are the slides, blog, code, similar problems and other resources used in the video https://cfstep.com/codeforces/contests/contest-1988/problem-d/
If you need any help, or if you notice anything wrong with the easy version of the problems, do let me know in the comment section.