ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1472. Martian Army

Hint!
Posted by IgorKoval [PskovSU] 3 Sep 2013 01:55
Observe than A[i] must be equal 0 or 1 ( no double ).
Just compute dp[v]. dp[v] is cost of traffic of subTree with root v if A[v] = 1.
If A[v]=0 than cost(of traffic of subTree with root v) equals zero.

Edited by author 03.09.2013 01:58

Edited by author 03.09.2013 01:59