935f专题

CodeForces - 935F Fafa and Array —— 线段树

Fafa has an array A of n positive integers, the function f(A) is defined as ∑ i = 1 n − 1 ∣ a i − a i + 1 ∣ \displaystyle\sum_{i=1}^{n-1} |a_{i}-a_{i+1}| i=1∑n−1​∣ai​−ai+1​∣. He wants to do q queries