void push_down(int pos)
{
if(tree[pos].x==1)
{
tree[left].mx=tree[pos].lazy1+tree[pos].lazy2;//一定要加上lazy2
tree[right].mx=tree[pos].lazy1+tree[pos].lazy2;
tree[left].lazy1=tree[pos].lazy1,tree[left].x=1;
tree[right].lazy1=tree[pos].lazy1,tree[right].x=1;
tree[left].lazy2=tree[pos].lazy2;//很重要
tree[right].lazy2=tree[pos].lazy2;//很重要
}
else if(tree[pos].lazy2!=0)
{
tree[left].mx+=tree[pos].lazy2;
tree[right].mx+=tree[pos].lazy2;
tree[left].lazy2+=tree[pos].lazy2;
tree[right].lazy2+=tree[pos].lazy2;
}
tree[pos].lazy1=0,tree[pos].x=0;
tree[pos].lazy2=0;
}
不然会错的很惨 ( 超小声)