Number of subsegments with maximum element equal to K

Правка en1, от CopeCope, 2018-01-30 19:40:42

Given array A of N (N <= 106 ) elements (Ai <= 109 ). Given Q queries (Q <= 106 ). Every query consist of number K (K <= 109). For every query find number of subsegments such that their maximum element is K.

Test case:
5
1 2 3 4 3
3
2
3
4
Output:
2
4
8

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский CopeCope 2018-01-30 22:02:42 121 Tiny change: 'n4 \n8' -> 'n4 \n8 $->$'
en2 Английский CopeCope 2018-01-30 20:49:12 1 Tiny change: ' <= $10^9$). For eve' -> ' <= $10^9$ ). For eve'
en1 Английский CopeCope 2018-01-30 19:40:42 374 Initial revision (published)