I participated in this month’s long challenge. I got stuck on Minimum Subtree Cover (SUBTRCOV) problem. After lot of trials and analysis, I was able to solve for all testcases Except 1.
My Solution link:
https://www.codechef.com/viewsolution/47729616
I had spent couple of sleepless nights to find out what went wrong, or at least to comeup with a test case where my code would break.
Please help me in identifying the issue.
Summary of my approach:
- Find one of the two vertex of the diameter of the tree.
- Then fix the vertex from 1. as root of the tree.
- Calculate subtree node sizes and save it in each node of the tree.
- Do some sort of tree to linear decomposition (like heavy light decomposition)
- Lastly, in a while loop, keep adding the size of the Next longest linear node sequence and check if total node count is > k
Thanks in advance.