后缀数组简介 #1107
Replies: 12 comments 5 replies
-
感觉这个优化是没有必要的,比如我可以把原文的代码改成这样 //for (i = 1; i <= n; ++i) ++cnt[px[i] = rk[id[i]]];
for (i = 1; i <= n; ++i) ++cnt[rk[i]];
for (i = 1; i <= m; ++i) cnt[i] += cnt[i - 1];
//for (i = n; i >= 1; --i) sa[cnt[px[i]]--] = id[i];
for (i = 1; i <= n; ++i) sa[cnt[rk[id[i]]]--] = id[i];; |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Milk Patterns这道题不是SAM裸题吗?在SAM的后缀链接树上DP维护出现次数,然后遍历整颗树找出len最大的出现次数>=k的结点即可。用SA做还麻烦一些,还要单调队列或者二分哈希什么的。 |
Beta Was this translation helpful? Give feedback.
-
为什么 |
Beta Was this translation helpful? Give feedback.
-
求SA那可以把 |
Beta Was this translation helpful? Give feedback.
-
为什么 |
Beta Was this translation helpful? Give feedback.
-
那么问题来了,在 2004 国集论文中写 SA 的那位 dalao 不是姓许嘛 |
Beta Was this translation helpful? Give feedback.
-
请问 这一子目 是不是可以通过二分 |
Beta Was this translation helpful? Give feedback.
-
“用函数 cmp 来计算是否重复”的常数优化有点太抽象了吧 想不出任何道理能变快 实测也只能得到评测机波动的结论 早就是O2时代了 这点小聪明没什么必要 建议删除 |
Beta Was this translation helpful? Give feedback.
-
请问一下,如果后缀排序按照给定的写法, |
Beta Was this translation helpful? Give feedback.
-
关于height数组,无论排名还是编号,示例代码又是从0开始了,与此节开头部分约定的从1开始矛盾了。 |
Beta Was this translation helpful? Give feedback.
-
https://oi-wiki.org/string/sa/
OI Wiki 是一个编程竞赛知识整合站点,提供有趣又实用的编程竞赛知识以及其他有帮助的内容,帮助广大编程竞赛爱好者更快更深入地学习编程竞赛
Beta Was this translation helpful? Give feedback.
All reactions