Problem from one Serbian contest

Правка en2, от Brankonymous, 2018-10-29 23:10:57

Hi, can someone help me solve this problem:

Input consist of integer n and array a of n integers. Output number of pairs (a[i],a[j]), i<j who are adjacent or for all k (i<k<j) this equation is true: a[k]<=min(a[i],a[j]).

1<=n<=10^6

0<=a[i]<=2^31

example:

8

4 1 2 3 6 5 1 2

Output: 11

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Brankonymous 2018-10-29 23:10:57 50 Tiny change: 'a[i]<=2^31' -> 'a[i]<=2^31\n\nexample:\n\n8\n\n4 1 2 3 6 5 1 2\n\nOutput: 11'
en1 Английский Brankonymous 2018-10-29 23:09:10 287 Initial revision (published)