MAXN=1e6+5会RE。改2e6就AC

P1253 扶苏的问题

@[水星湖](/user/974277) 红名大佬解释一下
by steveyang137 @ 2024-07-20 10:58:49


```cpp if(s<=l&&r<=t) { seg[p]={k,k,0}; pushdown(p); return; } ``` ```cpp if(s<=l&&r<=t) { pushdown(p); seg[p].mx+=k; seg[p].sum_tag+=k; return; } ``` 里调用pushdown会越界
by taffy_official @ 2024-07-20 11:04:41


线段树不是要开四倍空间吗?
by I_will_AKIOI @ 2024-07-20 11:08:50


@[I_will_AKIOI](/user/565265) 仔细看我的seg开的是maxn<<2
by steveyang137 @ 2024-07-20 18:36:30


@[taffy_official](/user/771357) 有道理。那我特判叶子节点还是怎么
by steveyang137 @ 2024-07-20 18:37:35


@[taffy_official](/user/771357) 我糖了,到位置不用pushdown就行了。多谢!
by steveyang137 @ 2024-07-20 19:30:20


|