摘要: 前置知识:洛谷P4198 楼房重建 在本题中,需统计 $\mathrm{s[i]}>\max_{j=1}^{i-1}s[j]$ 的 $\mathrm{i}$ 的个数. 1.$\mathrm{mx[i]}$ 为区间最大值 2.$\mathrm{cnt[i]}$ 为在考虑区间 $[\mathrm{l}, 阅读全文
posted @ 2021-09-14 08:59 guangheli 阅读(27) 评论(0) 推荐(0)
摘要: 做法一: 线段树合并. 令 $\mathrm{dp[x][i]}$ 表示以 $\mathrm{x}$ 节点为根的子树全部被覆盖且延伸到了深度为 $\mathrm{i}$ 的祖先. 考虑 $\mathrm{x},\mathrm{y}$ 两个子树如何合并: 有 $\mathrm{dp'[x][i]=dp 阅读全文
posted @ 2021-09-14 08:01 guangheli 阅读(50) 评论(0) 推荐(0)