The question says,
Given an array A with N integer numbers, output the minimum number of operations needed to make the sequence non decreasing.
An operation represents choosing a number in the array A[i], summing it to A[i + 1] or A[i - 1], and deleting A[i]
The link to the problem ( spanish ): https://omegaup.com/arena/problem/Torres#problems
Example:
3
5 2 1
Answer: 2
In this case we must join all the numbers, to turn the sequence to { 8 }, which is non-deceasing
Limits:
N <= 5000
A[i] <= 10^5
I think this problem can be solved using DP, but i can't discover a state that can represent the problem in a small and correct way.
Thanks in advance.