Dp on trees

Can anyone help me with this question https://codeforces.com/problemset/problem/1153/D.
Please Help…anyone???

1 Like

You know team name for icpc ?
“DP nahi aati”
Have you checked editorial for this problem ? In what are part are you facing issue ?

1 Like

Yes i have checked the editorial, I am stuck at the part where

There should be at least dp[i]ones in the subtree of i such that the number on i is one. Then k+1−dp[1] is the final answer

Can you please elaborate the idea?or plz explain your approach @l_returns .
Please help @vijju123,@anon55659401,@aryanc403,@ssjgz