摘要:
严格上来说,dsu on tree 是一种遍历方式。 有时,我们不得不完整遍历每棵子树来找出每个子树的信息,或者说没有比遍历子树更优的方案,就可以尝试使用 dsu on tree 来遍历,可以直接 \(n ^ 2 \to n \log n\)。 例题 CF600E,让你求每个子树的所有众数之和。 初 阅读全文
摘要:
因为我太菜了,只提供 Div2A ~ Div2D。 A 从后往前遍历,如果遇到 \(i + 1 > 0\) 就对 \(i\) 进行一次操作。 #include <bits/stdc++.h> #define int long long using namespace std; const int N 阅读全文