Need help with a simple Divide and Conquer problem

Правка en1, от heavenly_, 2024-09-11 12:04:39

Hi, I have this DnC problem, I would greatly appreciate any help, thank you!

Given an array a with n elements, calculate the sum of min * max over every ranges [l, r] (1 <= l <= r <= n)

Constraints:

1 <= n <= 1e5, 1 <= a_i <= 1e9

Sample test: 4 1 4 3 1

Answer: 58

Теги divide and conquer

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский heavenly_ 2024-09-11 12:05:19 4 Tiny change: 'le test:\n4\n1 4 3 1\' -> 'le test:\n\n4\n\n1 4 3 1\'
en1 Английский heavenly_ 2024-09-11 12:04:39 331 Initial revision (published)