上一页 1 ··· 5 6 7 8 9
摘要: "题面" 主席树启发式合并,每次连边维护并查集,集合大小,求lca所需信息,合并两个树上的主席树, 重点看代码. cpp include include include include include using namespace std; const int N = 8e4 + 1, M = 2 阅读全文
posted @ 2019-02-23 22:24 茶Tea 阅读(123) 评论(0) 推荐(0) 编辑
摘要: "题面" Source: unordered_map: cpp include include include include using namespace std; const int maxM = 200005; define LL long long char mp[20][20]; int 阅读全文
posted @ 2019-02-23 15:57 茶Tea 阅读(105) 评论(0) 推荐(0) 编辑
摘要: "题面" Solution1: $$ \begin{aligned} &\sum_{i=1}^n\sum_{i=1}^nijgcd(i,j) \\ =&\sum_{d=1}^dd\sum_{i=1}^{\frac{n}{d}}\sum_{j=1}^{\frac{n}{d}}ijd^2[\ gcd(i 阅读全文
posted @ 2019-02-22 22:39 茶Tea 阅读(133) 评论(0) 推荐(0) 编辑
摘要: ![](https://i.loli.net/2019/02/22/5c6ff04c8e32c.png) 阅读全文
posted @ 2019-02-22 20:50 茶Tea 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 快速求一个积性函数 $f$ 的前缀和, 记为 $S$ $$S(n)=\sum_{i=1}^{n} f(i)$$ 考虑一个积性函数 $g$ $$ \begin{aligned} & \sum_{i=1}^{n}(f g)(i) \\ =& \sum_{i=1}^{n}\sum_{d|n}^{i}f(d 阅读全文
posted @ 2019-02-21 22:31 茶Tea 阅读(127) 评论(0) 推荐(0) 编辑
摘要: "题面" Solution: 板子不解释 cpp include include include include using namespace std; namespace io { char buf[1 1; if (val 1; int sum = 0; if (Left 阅读全文
posted @ 2019-02-20 20:47 茶Tea 阅读(160) 评论(0) 推荐(0) 编辑
摘要: "题面" 题意: 给一个字符串,求它有多少个不同的子串 多组数据。 Solution : 模板题,用所有的减去重复的即可。 cpp include include include include using namespace std; const int N = 1e6; char str[N + 阅读全文
posted @ 2019-02-16 14:07 茶Tea 阅读(139) 评论(0) 推荐(0) 编辑
摘要: "题面" 参考:《左偏树的特点及运用——黄河源》 我们将这个数列划为很多个互不相交的区间,每一段区间内的 $b$ 是相等的,即 $b[l[i]]=b[l[i]+1]=...=b[r[i]]=w[i]​$, $l[i],r[i]​$ 为区间 $i​$ 的左右端点 先假设题目时要求b不下降的(比较好讨论 阅读全文
posted @ 2019-02-15 21:51 茶Tea 阅读(246) 评论(0) 推荐(1) 编辑
摘要: 莫比乌斯反演 直接上结论: 若有 $$ g(n)=\sum_{d|n}f(n) $$ 则有 $$ f(n)=\sum_{d|n}\mu(d)\ g(\frac{n}{d}) $$ 简而言之就是 若 $g=f 1$ , 则有 $f=\mu g$ ($“ ”$为狄利克雷卷积) 若看懂了就可直接到文章末尾 阅读全文
posted @ 2019-02-13 14:57 茶Tea 阅读(353) 评论(1) 推荐(1) 编辑
上一页 1 ··· 5 6 7 8 9