きろく

特筆すべき記録のまとめ

Kodaman コンテスト:L - Let's Shoot!

問題

https://www.hackerrank.com/contests/kodamanwithothers/challenges/lets-shoot/problem

解法

以下の DP を考える.

dp(i, a, b, c) := i - 1 番目まで見て Type 1 に a 回,Type 2 に b 回,Type 3 に c 回トレーニングしたとき,i 番目以降必要なコストの和の最小値

遷移は i 番目をトレーニングするかどうかの 2 通り.O(N * K^3).

解答

https://www.hackerrank.com/contests/kodamanwithothers/challenges/lets-shoot/submissions/code/1316479563

f:id:babcs2035:20190923220613p:plain