|
|
вернуться в форумgood dynamic problem for each node v,calculate a(v)-maximum cost achieved by the subtree with root "v" in which v will attend, and n(v)-maximum cost achived by the subtree with root "v" in which v will not attend. a(v)=p(v)+n(v1)+n(v2)+...+n(vn), vi-is the child of v.,p(v)-is the point of v itself. n(v)=sum(max(n(vi),a(vi))),for all i-s. and simply use DFS. Re: good dynamic problem Послано hehe 29 мар 2013 11:22 thnxxxxxxxxx |
|
|