[Help] Split array into maximum number of segments such that their sums is non-decreasing

Revision en1, by Libraion, 2021-11-20 19:06:56

Given an array of $$$N$$$ $$$(1 \le N \le 10^5)$$$ elements $$$A_1,A_2,\dots,A_N$$$ $$$(1 \le A_i \le 10^6)$$$. You can replace $$$2$$$ consecutive elements with their sum. Find the minimum number of replacements such that the resulting array is non-decreasing.

As you can easily see, it is the same as split $$$A$$$ into maximum number of segments such that their sums from left to right is non-decreasing.

Thanks.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Libraion 2021-11-20 19:06:56 486 Initial revision (published)