_zqh_ @ 2024-12-09 15:54:45
pushup
,确保不要出现漏解的情况,应该是:
void pushup(int id) {
sum(id) = sum(ls) + sum(rs);
maxl(id) = max(maxl(ls), sum(ls) + maxl(rs));
maxr(id) = max(maxr(rs), sum(rs) + maxr(ls));
maxs(id) = max(max(maxs(ls), maxs(rs)), maxr(ls) + maxl(rs));
}
build
的时候每个元素的赋值是 by Xiaohaoyu1020 @ 2024-12-12 23:42:32
谢谢提醒