玄学
查看原帖
玄学
712794
Azure_Space楼主2024/10/12 10:14

我一开始push_down写挂了

void push_down(int x)
{
    int maxn=max(t[x*2].maxn,t[x*2+1].maxn);
    if(t[x].maxn==t[x*2].maxn) change(x*2,t[x].tg1,t[x].tg2,t[x].tg3,t[x].tg4);
    else change(x*2,t[x].tg2,t[x].tg2,t[x].tg4,t[x].tg4);
    if(t[x].maxn==t[x*2+1].maxn) change(x*2+1,t[x].tg1,t[x].tg2,t[x].tg3,t[x].tg4);
    else change(x*2+1,t[x].tg2,t[x].tg2,t[x].tg4,t[x].tg4);
    t[x].tg1=t[x].tg2=t[x].tg3=t[x].tg4=0;
}

把两个if里的maxn写成了t[x].maxn,然而这能过5,6。这是什么原理?

2024/10/12 10:14
加载中...