27 条题解
-
0Cowboy80 LV 8 @ 2009-03-15 11:07:55
我是f表示在i为根子树中建立j个伐木场,然后i下游最近的伐木场在i往下数第k个。
我不是用背包,而是对每个i,j,k对儿子们用了二分。后来发现超时,又加了个类似线段树的记忆化-_-|||结果就ac了……
-
02009-03-11 22:21:43@
成功地把这题AC率降低25个百分点
-
02009-03-10 18:49:20@
f表示以I为根结点,子树中建K个伐木场,在I上面最近的伐木场为K的最小费用,对于每个I,用背包解决。另外,如果不是像李永刚那么强的话,最好分是不是在I建伐木场两种情况讨论,这样方便一些
-
02009-03-09 20:29:34@
...
-
02009-03-09 22:57:54@
这题难度也三啊?
-
02009-03-09 12:24:28@
树形Dp即可。
注意这里需用三维状态,否则会有后效性。
提示:
设立状态 f[from][to][k]表示以from为根的子树建立k个伐木场,且有一个祖先伐木场为to的最小费用。 -
-22015-10-05 15:01:50@
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmmmmmmmmmmmmmmmmmqqqqqqqqqqqqqqqqqqqmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnnnnnnbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjmnnnnnnnnnnnn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