标签:mat 树形dp 多少 near http lin tps usaco href
Luogu4186
设dp[i]表示i点需要放多少个农民.则有
\(if(near[i]-dep[i]<=dep[i]-1)\ dp[i]=1;\)
\(else\ dp[i]=\sum dp[son[i]]\)
AC代码
树上思维题
原文地址:https://www.cnblogs.com/lizehon/p/10479137.html