20210713考试-2021noip14
T1 队长快跑
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5,INF=0x7fffffff;
int n,a[N],b[N],ans,s[N<<1],top;
struct xds
{
int l,r,mx,laz;
}t[N*4];
void build(int p,int l,int r){
t[p].l=l;
t[p].r=r;
if(l==r)return ;
int mid=l+r>>1;
build(p<<1,l,mid);
build(p<<1|1,mid+1,r);
return ;
}
void update(int p){
t[p].mx=max(t[p<<1].mx,t[p<<1|1].mx);
return ;
}
void pushdown(int p)
{
if(t[p].laz)
{
t[p*2].mx+=t[p].laz;
t[p*2+1].mx+=t[p].laz;
t[p*2].laz+=t[p].laz;
t[p*2+1].laz+=t[p].laz;
update