For each number, find out the range where it is the largest
For each number in left part, find out what least amount is needed in right part to surpass the max value of this part and store right part {start point, end point}
Or do vice-versa in case right part has less elements
There can be as much as n(lg(n)) such pairs
Now build a segment tree and assume all the numbers are dead at the beginning
Keep making numbers alive in descending order
Use stored {start point, end point}s to make query when all the numbers more or equal needed by respective {start point, end point} are added to the segment tree
For each segment, the max value can pair up with a number from the left or right part as well. Take care of that case.