[CodeForces] D. Make The Fence Great Again

Problem

 

Each fence is increased at most 2 times, so dp[i][j] is the min cost to make A[0, i] great with the last fence A[i] increased j times.

The answer is min of dp[n - 1][].

 

posted @ 2022-01-18 03:22  Review->Improve  阅读(41)  评论(0编辑  收藏  举报