I AK IOI!!!

SP1716 GSS3 - Can you answer these queries III

@[Eason_AC](/space/show?uid=112917) `update`中`t[p].rmax = max(t[p * 2 + 1].rmax, t[p * 2 + 1].sum + t[p * 2].sum);`改成`t[p].rmax=max(t[p*2+1].r,t[p * 2 + 1].sum + t[p * 2].rmax`
by andyli @ 2019-08-10 17:01:00


@[Eason_AC](/space/show?uid=112917) `build`和`change`中`sum,lmax,rmax,dat`都要改
by andyli @ 2019-08-10 17:01:45


明年吧
by 迷残云 @ 2019-08-10 17:02:57


@[Eason_AC](/space/show?uid=112917) `ask`应该改成类似这种: ```cpp if (x <= l && r <= y) return tree[o]; int m = (l + r) >> 1; if (y <= m) return query(lc, l, m, x, y); if (x > m) return query(rc, m + 1, r, x, y); Node ans, lans = ask(lc, l, m, x, y), rans = ask(rc, m + 1, r, x, y); ans.lmax = max(lans.lmax, lans.sum + rans.lmax); ans.rmax = max(rans.rmax, rans.sum + lans.rmax); ans.tmax = max(max(lans.tmax, rans.tmax), lans.rmax + rans.lmax); return ans; ``` tmax就是dat
by andyli @ 2019-08-10 17:03:35


@[Eason_AC](/space/show?uid=112917) 主函数中x=1中l可能大于r,应swap
by andyli @ 2019-08-10 17:05:03


就像上面说的,ask没写完整,按您的写法没有考虑答案跨左右区间的情况
by andyli @ 2019-08-10 17:06:41


@[Eason_AC](/space/show?uid=112917) you really AKs IOI
by Spasmodic @ 2019-10-03 16:38:26


@[Eason_AC](/user/112917) 考古(
by UperFicial @ 2021-07-18 09:02:19


|