Split soldiers into contiguous groups. Group value = where is sum of strengths in group. = max value for first soldiers.
Transition: where is prefix sum. Expand . Separate terms by and . Result: linear in with slope depending on . Apply CHT. Handle max instead of min by negating.