正文
增加 7 行删除 7 行
21 行未改动22232425262728293024 行未改动55565758596061626352 行未改动1161171181191201211221231241251261271281291301311321331341351361371381391401411421431441457 行未改动21 行未改动```cpp//12252024832524#include <cstdio>#include <algorithm>using namespace std;typedef long long LL;const int MAXN = 500005;const LL INF = 0x3f3f3f3f3f3f3f3fll;24 行未改动struct node{int l,r;LL x,y,tx,ty;//当前的与历史的node(){}node(int l1,int r1,LL x1,LL y1,LL tx1,LL ty1){l = l1;r = r1;52 行未改动Build(1,1,n);for(; m ;-- m){int opt = Read();if(opt == 1)//区间加{int l = Read(),r = Read(),x = Read();change(1,l,r,node(0,0,x,-INF,x,-INF));}else if(opt == 2)//区间减{int l = Read(),r = Read(),x = Read();change(1,l,r,node(0,0,-x,0,-x,0));}else if(opt == 3)//区间赋值{int l = Read(),r = Read(),x = Read();change(1,l,r,node(0,0,-INF,x,-INF,x));}else if(opt == 4)//单点询问{int x = Read();node ans = query(1,x);Put(Max(a[x]+ans.x,ans.y),'\n');}else if(opt == 5)//历史最大值{int x = Read();node ans = query(1,x);Put(Max(a[x]+ans.tx,ans.ty),'\n');7 行未改动21 行未改动22232425262728293024 行未改动55565758596061626352 行未改动1161171181191201211221231241251261271281291301311321331341351361371381391401411421431441457 行未改动21 行未改动```cpp//12252024832524#include <cstdio>#include <algorithm>using namespace std;typedef long long LL;const int MAXN = 500005;const LL INF = 0x3f3f3f3f3f3f3f3fll;24 行未改动struct node{int l,r;LL x,y,tx,ty;//当前的与历史的node(){}node(int l1,int r1,LL x1,LL y1,LL tx1,LL ty1){l = l1;r = r1;52 行未改动Build(1,1,n);for(; m ;-- m){int opt = Read();if(opt == 1)//区间加{int l = Read(),r = Read(),x = Read();change(1,l,r,node(0,0,x,-INF,x,-INF));}else if(opt == 2)//区间减{int l = Read(),r = Read(),x = Read();change(1,l,r,node(0,0,-x,0,-x,0));}else if(opt == 3)//区间赋值{int l = Read(),r = Read(),x = Read();change(1,l,r,node(0,0,-INF,x,-INF,x));}else if(opt == 4)//单点询问{int x = Read();node ans = query(1,x);Put(Max(a[x]+ans.x,ans.y),'\n');}else if(opt == 5)//历史最大值{int x = Read();node ans = query(1,x);Put(Max(a[x]+ans.tx,ans.ty),'\n');7 行未改动