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