Hi, is there a reason why my submission* got accepted meanwhile my rough estimate for time complexity is O(n^3), because i did a dfs and for every node i calculate a subset sum of each subtree size. Or is this because of weak tc? thanks
*) https://mirror.codeforces.com/contest/1856/submission/290385616
The time complexity will be O($$$n^2$$$). For each node we iterate through it's children and the number of parent-children pairs is n-1. We then calculate the subset sum in O($$$n$$$) leading to O($$$n^2$$$).