CF1108E1 Array and Segments (Easy version)
题目描述
给定你一个长度为 $n$ 的数组 $a$,再给定你 $m$ 对数字 $[l_i,r_i]$。你可以选择其中的几对数字作为两个端点,再将数组 $a$ 中的两个端点内的数字全部减一。(例如现有一对 $[l_i,r_i]$ 为 $[1,3]$ ,而数组 $a$ 为 `1 2 3 4 5`,若使用这对 $[l_i,r_i]$ 数组就会变成 `0 1 2 4 5`)
现在请你求出怎样使得数组 $a$ 中的最大值减去最小值最大。
输入格式
无
输出格式
无
说明/提示
In the first example the obtained array $ b $ will be $ [0, -4, 1, 1, 2] $ so the answer is $ 6 $ .
In the second example the obtained array $ b $ will be $ [2, -3, 1, -1, 4] $ so the answer is $ 7 $ .
In the third example you cannot do anything so the answer is $ 0 $ .