Problem 3319 · Medium
Measure each subtree bottom-up, record the sizes of perfect subtrees, and read the k-th largest.
Open the interactive visualisation