to be the weight of interval [L, R]. For each position i , hery defines interval [L, R] as a wonderful interval of i if:. is the max weight of all wonderful intervals of i. Hery wants to know the
Hery has two arrays a and k with n integers. Let sum_{i=L}^R{a_i} ∑ i=L R a i to be the weight of interval [L, R]. For each position i (1 ≤ i ≤ n), hery defines interval [L, R] as a wonderful interval of i if: • 1 ≤ L ≤ R ≤ n • 0 ≤ i − L, R − i ≤ k_i 0≤i−L,R−i≤k i . For each i from 1 to n, s_i s i is the max weight of all wonderful intervals of i. Hery wants to know the value of: sum_{i=1}^n{s_i} ∑ i=1 n s i .
(图片来源网络,侵删)