About counting the number of subarray

Правка en2, от National_Wind, 2020-12-02 17:02:59

Hi guys, I have this problem. In a given array a length n, how many subarray are there that satisfies: max_element — min_element of the subarray is even. Given that 1 <= n <= 1e5, 1 <= ai <= 1e9. 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)