segment tree in this prob

Revision en1, by ..OvO.., 2020-07-05 21:01:45
Can somebody tell me how to solve
these kind of problem using SEGMENT TREE

problem statement:

calculate the maximum sum of the element of the sequence such that
the elements are in strictly decreasing order and first and last points
of the sequence are in it and the first point is always greater
than any other points in the sequence .

ex:   if the sequence it [30,27,24,15,17,10,12]