摘要: 描述 给定一个长度为 n 的非负整数序列 a[1..n]。 你每次可以花费 1 的代价给某个 a[i] 加1或者减1。 求最少需要多少代价能将这个序列变成一个不上升序列。 输入 第一行一个正整数 n。 接下来 n 行每行一个非负整数,第 i 行表示 a[i]。 1 ≤ n ≤ 500000 0 一个 阅读全文
posted @ 2017-10-27 18:20 江南何采莲 阅读(269) 评论(0) 推荐(0) 编辑
摘要: Description Sonya was unable to think of a story for this problem, so here comes the formal description. You are given the array containing n positive 阅读全文
posted @ 2017-10-27 17:25 江南何采莲 阅读(203) 评论(0) 推荐(0) 编辑