About counting the number of subsequence (consecutive)

Правка en1, от National_Wind, 2020-12-01 19:10:38

Hi guys, i have this problem. In a given array a length n, how many consecutive subsequence are there that satisfies: max_element — min_element of the subsequence is even. 1 <= n <= 1e5. I can't figure out a better solution than O(n^2) solution. How to solve this problem? Thanks!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский National_Wind 2020-12-02 17:02:59 94
en1 Английский National_Wind 2020-12-01 19:10:38 345 Initial revision (published)