: 輸入:一個 n 個頂點的樹 T,每一個頂點 v 有一個整數權重 w(v),及一整數 k。 : 輸出:一條 T 上的路徑(任意起點終點),其路徑上頂點權重的總和為 k 。 : 推 DJWS: 能不能推薦幾篇centroid/spine decomposition的教學資料? 03/02 08:14 http://wenku.baidu.com/view/60c6aa1ffc4ffe473368aba8.html 這個有介紹一下 centroid decomposition。 http://www.cnblogs.com/xiao_wu/archive/2010/06/01/1748728.html 一些相關問題 http://fanhq666.blog.163.com/blog/static/81943426201172472943638/ 動態情況 我認真的搜尋了一下,我問的問題有出現在 zoj 2304 / poj 2114 Boatherds http://blog.sina.com.cn/s/blog_5123df35010098vr.html IOI 2011 也有這題 http://www.ioi2011.or.th/hsc/tasks/solutions/race.pdf BZOJ 1758 是找出樹上 length constrainted 的 maximum density path https://www.byvoid.com/blog/wc2010-rebuild 網路上看的作法是O(n lg n lg RANGE) 理論上是可以做到O(n lg n) (spine decomposition) 可以參考 An optimal algorithm for the maximum-density path in a tree