摘要: 题面 https://loj.ac/problem/2137 题解 前置知识 广义SAM https://zhuanlan.zhihu.com/p/34838533 本题给出一棵带点权的树,保证这棵树的叶子结点不超过20,求树上所有的有向路径形成的字符串中,不同字符串的数量。 发现一个事情:如果把原 阅读全文
posted @ 2020-10-05 14:08 coder66 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 题面 https://codeforces.com/contest/235/problem/C 题解 前置知识 SAM https://oi-wiki.org/string/sam/ 字符串哈希 https://oi-wiki.org/string/hash/ 给出字符串s,要求多次询问给出的字符串 阅读全文
posted @ 2020-10-05 14:07 coder66 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 题面 https://darkbzoj.tk/problem/1426 题解 记$Pr(i,j)$为买了i次,正好买到j种票的概率。(“正好”的含义是:第i次刚好解锁一种新的票) 则所求答案为$\sum_{\frac{x(x+1)}{2}}Pr(x,n)$。 将其拆开,设$\sum_x{x^2}Pr 阅读全文
posted @ 2020-10-05 10:57 coder66 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题面 http://acm.hdu.edu.cn/showproblem.php?pid=5421 题解 前置知识 PAM https://www.cnblogs.com/cjyyb/p/8460058.html 这道题很好地证明了PAM是可以双向添加的。 如果只有操作2、3、4,那就是PAM模板而 阅读全文
posted @ 2020-10-04 20:04 coder66 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题面 https://codeforces.com/problemset/problem/932/G 题解 前置知识 PAM https://www.cnblogs.com/cjyyb/p/8460058.html 回文划分相关dp https://codeforces.com/blog/entry 阅读全文
posted @ 2020-10-04 20:03 coder66 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题面 https://atcoder.jp/contests/agc034/tasks/agc034_f 题解 前置知识 FWT https://zhuanlan.zhihu.com/p/41867199 首先设得到i的期望步数为E[i]。容易看出E[0]=0以及对i>0,\(E[i]=\sum_{ 阅读全文
posted @ 2020-10-04 19:52 coder66 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题面 http://codeforces.com/contest/1034/problem/E 题解 前置知识 FWT https://zhuanlan.zhihu.com/p/41867199 不交并卷积 是可以使用FWT进行优化的一种卷积形式。 \(c{[}k{]}=\sum\limits_{i 阅读全文
posted @ 2020-10-04 19:50 coder66 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 题面 https://darkbzoj.tk/problem/2658 题解 前置知识 笛卡尔树 https://blog.csdn.net/qq_36056315/article/details/79845193 FHQ Treap https://blog.csdn.net/CABI_ZGX/a 阅读全文
posted @ 2020-10-04 19:48 coder66 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题面 http://darkbzoj.tk/problem/2616 题解 前置知识 笛卡尔树 https://blog.csdn.net/qq_36056315/article/details/79845193 先建出笛卡尔树,并定义几个变量: $lb[i]$表示第i列左侧第一个低于i的位置。 $ 阅读全文
posted @ 2020-10-04 19:47 coder66 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题面 http://codeforces.com/contest/662/problem/C 题解 前置知识 FWT:https://zhuanlan.zhihu.com/p/41867199 看到n仅仅20,自然想到状压。 因为每一行、列最多操作一次即可,所以注意到一个性质:如果每一行分别有没有操 阅读全文
posted @ 2020-10-04 19:46 coder66 阅读(121) 评论(0) 推荐(0) 编辑