Skip to content

Commit

Permalink
修复一些问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zerolfx committed Feb 16, 2019
1 parent 06a6642 commit ee82cd6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions 1-数据结构.md
Expand Up @@ -188,7 +188,7 @@ struct IntervalTree {

## 均摊复杂度线段树

+ 区间取 max,区间求和。
+ 区间取 min,区间求和。

```cpp
namespace R {
Expand Down Expand Up @@ -219,7 +219,7 @@ namespace R {
mod(lc, m1[o]); mod(rc, m1[o]);
}
void build(int o, int l, int r) {
if (l == r) { int t; read(t); sum[o] = m1[o] = t; m2[o] = -1; cm1[o] = 1; }
if (l == r) { int t; read(t); sum[o] = m1[o] = t; m2[o] = -INF; cm1[o] = 1; }
else { build(lson); build(rson); up(o); }
}
void update(int ql, int qr, int x, int o, int l, int r) {
Expand Down
2 changes: 1 addition & 1 deletion 2-数学.md
Expand Up @@ -322,7 +322,7 @@ void get_fac(LL n, LL cc = 19260817) {
}
```

## 线性递推
## BM 线性递推

```cpp
// k 为 m 最高次数 且 a[m] == 1
Expand Down
6 changes: 5 additions & 1 deletion 5-字符串.md
Expand Up @@ -7,7 +7,7 @@
+ 广义后缀自动机如果直接使用以下代码的话会产生一些冗余状态(置 last 为 1),所以要用拓扑排序。用 len 基数排序不能。
+ 字符集大的话要使用`map`
+ 树上 dp 时注意边界(root 和 null)。
+ rsort 需要初始化
+ rsort 中的数组 a 是拓扑序 [1, sz)

```cpp
namespace sam {
Expand Down Expand Up @@ -71,6 +71,7 @@ void ins(int ch, int id) {


+ 按字典序建立后缀树 注意逆序插入
+ rsort2 里的 a 不是拓扑序,需要拓扑序就去树上做

```cpp
void ins(int ch, int pp) {
Expand Down Expand Up @@ -254,6 +255,9 @@ namespace lct_sam {

## 回文自动机

+ num 是该结点表示的前缀的回文后缀个数
+ cnt 是该结点表示的回文串在原串中的出现次数(使用前需要向父亲更新)

```cpp
namespace pam {
int t[N][26], fa[N], len[N], rs[N], cnt[N], num[N];
Expand Down
Binary file modified template.pdf
Binary file not shown.

0 comments on commit ee82cd6

Please sign in to comment.