题意 "题目链接" Sol 发现abcdef是互不相关的 那么meet in the middle一下。先算出abc的,再算def的 注意d = 0的时候不合法(害我wa了两发。。) cpp include define LL long long using namespace std; const ...
分类:
其他好文 时间:
2019-01-09 21:41:34
阅读次数:
210
题意 有操作 $0$ $u$:询问有多少个节点 $v$ 满足路径 $u$ 到 $v$ 上所有节点(包括)都拥有相同的颜色$1$ $u$:翻转 $u$ 的颜色 题解 直接用一个 $LCT$ 去暴力删边连边显然会 $T$ 那么只有两个颜色的话就可以建两棵 $LCT$ ,观察到每次单点修改颜色时其子树所包 ...
分类:
其他好文 时间:
2019-01-04 10:30:44
阅读次数:
264
"Triple Fat Ladies" Pattern Matchers have been designed for various sorts of patterns. Mr. HKP likes to observe patterns in numbers. After completing ...
分类:
其他好文 时间:
2019-01-03 18:15:14
阅读次数:
220
还是线性dp,有点感觉了,另外这个问题也可以用滚动数组 ...
分类:
其他好文 时间:
2019-01-03 16:41:01
阅读次数:
205
"【SPOJ】Longest Common Substring II" 多个字符串求最长公共子串 还是将一个子串建SAM,其他字符串全部跑一边,记录每个点的最大贡献 由于是所有串,要对每个点每个字符串跑完后去最小值才是每个点的最终贡献 cpp include include include incl ...
分类:
其他好文 时间:
2018-12-31 13:04:01
阅读次数:
188
题意 $\sigma_0(i)$ 表示 $i$ 的约数个数 求 $$ S_k(n)=\sum_{i=1}^n\sigma_0(i^k)\pmod {2^{64}} $$ 共 $T$ 组数据 $T\le10^4,n,k\le10^{10}$ 题解 其实 SPOJ 上还有 divcnt2,divcnt3 ...
分类:
其他好文 时间:
2018-12-31 11:20:40
阅读次数:
202
"【SPOJ】Longest Common Substring" 求两个字符串的最长公共子串 对一个串建好后缀自动机然后暴力跑一下 ~~废话~~ 讲一下怎么跑吧 从第一个字符开始遍历,遍历不到了再沿着$parents$走看能否找到出路,走到某个点时,统计一下走过了多少点然后更新答案 来说说这样做的正 ...
分类:
其他好文 时间:
2018-12-30 22:18:45
阅读次数:
165
"【SPOJ】Distinct Substrings" 求不同子串数量 统计每个点有效的字符串数量(第一次出现的) $\sum\limits_{now=1}^{nod}now.longest parents.longest$ My complete code cpp include using na ...
分类:
其他好文 时间:
2018-12-30 17:25:39
阅读次数:
146
Given a balanced parentheses string S, compute the score of the string based on the following rule: () has score 1 AB has score A + B, where A and B a ...
分类:
其他好文 时间:
2018-12-28 22:11:08
阅读次数:
243
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d ...
分类:
其他好文 时间:
2018-12-19 19:31:11
阅读次数:
142