
数据结构-后缀自动机
JeraKrs
本人目前就职于百度商业研发部,有需要内推的朋友简历可发我邮箱 jerakrs@qq.com
展开
-
hdu 4436 str2int(后缀自动机)
题目链接:hdu 4436 str2int解题思路将所有字符串拼接在一起,连接处用不会出现的字符10代替。然后根据拓扑序,维护每个节点的sum 取模后的和,cnt 以该节点为终止位置的字符串个数。代码#include <cstdio>#include <cstring>#include <queue>#include <algorithm>using namespace std;typede原创 2015-11-06 21:13:17 · 674 阅读 · 0 评论 -
uva 719 - Glass Beads(最小表示法 | 后缀自动机)
题目链接:uva 719 - Glass Beads题目大意:给定一个字符串,求最小表示法。解题思路:最小表示法。#include #include #include using namespace std;const int maxn = 1e4+5;char s[maxn];int main () { int cas; scanf("%d原创 2014-09-04 23:11:08 · 2073 阅读 · 0 评论 -
hdu 4641 K-string(后缀自动机 + 并查集)
题目链接:hdu 4641 K-string代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 300005;const int SIGMA_SIZE = 26;struct SAM { int sz, l原创 2015-11-12 21:45:48 · 1067 阅读 · 0 评论 -
hdu 5343 MZL's Circle Zhou(后缀自动机)
题目链接:hdu 5343 MZL’s Circle Zhou代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef unsigned long long ll;const int maxn = 90005;const int SIGMA_SIZE = 26;struct SA原创 2015-11-09 20:36:52 · 833 阅读 · 0 评论 -
spoj 8222 Substrings(后缀自动机)
题目链接:spoj 8222 Substrings代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 250005;const int SIGMA_SIZE = 26;struct SAM { int sz原创 2015-11-09 11:24:22 · 699 阅读 · 0 评论 -
spoj 1812 Longest Common Substring II(后缀自动机)
题目链接:spoj 1812 Longest Common Substring II代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 100005;const int SIGMA_SIZE = 26;const原创 2015-11-09 11:20:08 · 471 阅读 · 0 评论 -
spoj 1811 Longest Common Substring(后缀自动机)
题目链接:spojm 1811 Longest Common Substring代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 250005;const int SIGMA_SIZE = 26;struct S原创 2015-11-09 11:18:01 · 539 阅读 · 0 评论 -
spoj 7258 Lexicographical Substring Search(后缀数组 | 后缀自动机)
题目链接:spoj 7258 Lexicographical Substring Search代码 - 后缀数组#include <cstdio>#include <cstring>#include <stack>#include <vector>#include <algorithm>using namespace std;const int maxn = 90000 + 5;struc原创 2015-11-09 11:23:01 · 921 阅读 · 0 评论 -
zoj 3891 K-hash(后缀自动机)
题目链接:zoj 3891 K-hash代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 50005;const int maxm = 35;const int SIGMA_SIZE = 10;struct S原创 2015-11-06 22:00:15 · 1084 阅读 · 0 评论 -
Codeforces 235C Cyclical Quest(后缀自动机)
题目链接:Codeforces 235C Cyclical Quest代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 1e6 + 5;const int SIGMA_SIZE = 26;struct SAM {原创 2015-11-06 21:56:34 · 780 阅读 · 0 评论 -
poj 3415 Common Substrings(后缀数组 | 后缀自动机)
题目链接:poj 3415 Common Substrings代码-后缀数组#include <cstdio>#include <cstring>#include <stack>#include <vector>#include <algorithm>using namespace std;typedef long long ll;typedef pair<int,int> pii;c原创 2015-11-06 21:55:09 · 711 阅读 · 0 评论 -
Codeforces 427D Match & Catch(后缀自动机)
题目链接:Codeforces 427D Match & Catch代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 1e4 + 5;const int SIGMA_SIZE = 26;const int in原创 2015-11-06 21:58:24 · 794 阅读 · 0 评论 -
hdu 4622 Reincarnation(SAM)
题目链接:hdu 4622 Reincarnation解题思路对字符串的每个后缀串构建一次后缀自动机,后缀自动机中维护一个tot记录当前串有多少个不同子串,处理出二维ans数组。代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int原创 2015-11-01 23:13:57 · 1475 阅读 · 1 评论