CF862E Mahmoud and Ehab and the function
题目描述
给出长度为 $n$ 的数组 $a$ 和长度为 $m$ 的数组 $b$,定义函数 $f(j)$ ($0$ $≤$ $j$ $≤$ $m$ −$n$) 如图所示(未翻译的题面中的图),共有 $q$ 次更新,每次更新将 $a$ 数组中下标为 $l $\~$ r$ 中的每个数加上 $x$,对于原数组和每次更新后的数组,求 $f(j)$ 的最小值
输入格式
无
输出格式
无
说明/提示
For the first example before any updates it's optimal to choose $ j=0 $ , $ f(0)=|(1-1)-(2-2)+(3-3)-(4-4)+(5-5)|=|0|=0 $ .
After the first update $ a $ becomes $ {11,2,3,4,5} $ and it's optimal to choose $ j=1 $ , $ f(1)=|(11-2)-(2-3)+(3-4)-(4-5)+(5-6)=|9|=9 $ .
After the second update $ a $ becomes $ {2,2,3,4,5} $ and it's optimal to choose $ j=1 $ , $ f(1)=|(2-2)-(2-3)+(3-4)-(4-5)+(5-6)|=|0|=0 $ .
After the third update $ a $ becomes $ {1,1,2,3,4} $ and it's optimal to choose $ j=0 $ , $ f(0)=|(1-1)-(1-2)+(2-3)-(3-4)+(4-5)|=|0|=0 $ .