Problem 3299 · Hard

Sum of Consecutive Subsequences

Process values left to right, keeping for each value the chains that rise or fall by one into it, and add their sums.

Open the interactive visualisation