Make array non-decreasing with minimum cost (sum of changes). Transform: . Now make non-decreasing but with the same values allowed. = min cost for first elements, last value is .
Transition: . The is a prefix min. The adds a V-shape centered at . Heap operations: prefix all right breakpoints beyond the min point. Add to both heaps, balance.