avatar
y*u
1
Given an array A of positive integers. Convert it to a sorted array with
minimum cost. The only valid operation are:
1) Decrement with cost = 1
2) Delete an element completely from the array with cost = value of elemen11
avatar
v*i
2
【 以下文字转载自 EB23 讨论区 】
发信人: viviandynami ((patience is gold)), 信区: EB23
标 题: XM091?
关键字: YASJ
发信站: BBS 未名空间站 (Sat Feb 26 17:40:07 2011, 美东)
SR response 的落款是XM091?
有人知道者是谁吗?
这个是IO还是别的什么意思吗?只想知道我的case有没有被assign...
avatar
e*s
3
I think we can use DP.
Cost(1...i) = Cost(1...i-1) if(A[i-1] <= A[i])
min(Cost(1...i-1) + A[i], sum_{j= P(i) ...i-1}(A[j]-A[i]))
otherwise.
P(i) is the left most index with A[P(i)] > A[i].
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。