EASY(easy) sol:非常经典的题,取了一次之后,把线段树上这一段变成相反数 然后再贪心取和最大的. 重复以上操作,发现最后一定有对应的解,且根据贪心过程一定 是最大的 线段树上维护区间和最大/小及位置,左/右连续最大/小及位置, 取反标记 除了写起来特别麻烦之外都还好 #include <bits/stdc++.h> using namespace std; typedef int ll; inline ll read() { ll s=; ; char ch=' '; while(…