Help needed to solve this problem!!

Правка en2, от aya1909, 2020-10-05 18:28:35

You Are given an array A of N integers. You have to answer Q queries of form L R. Answer to each query is sum of lengths of all sub arrays in A whose maximum element lies in range [L,R].

Constraints:

1<=N,Q<=3*10^5 1<=A[i]<=10^9 1<=L<=R<=10^9

Input: 5 3 1 2 3 4 5 1 3 1 5 5 5

Output:

10 35 15

Теги range query

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский aya1909 2020-10-05 18:28:35 29
en1 Английский aya1909 2020-10-05 18:26:16 387 Initial revision (published)