ENG
RUS
Timus 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
1371
. Cargo Agency
Hint
Posted by
coolboy19521
7 Aug 2024 16:16
Most probably could be solved with centroid decomposition (didn't think much but have some ideas). But my solution is with tree dp with top to bottom dfs and bottom to top dfs. Some call is "rerooting".
© 2000–2024
Timus Online Judge Team
. All rights reserved.