Editorial for An Animal Contest 7 P2 - Squirrel Structures
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Hint 1
What happens with nodeHint 2
Solution
It turns out that the minimalIn essence, we just need to add each node to the parent of its parent.
Time Complexity:
Comments