2015年2月3日

hdu3613 扩展KMP

摘要: 一个串切成两个,左边如果是回文串加上左边价值,右边如果是回文串加上右边价值,求切一次得到的最大价值扩展KMP:for (i=1;i 2 #include 3 #include 4 using namespace std; 5 int next[500005]; 6 void EKMP(char *s... 阅读全文

posted @ 2015-02-03 23:11 xiao_xin 阅读(99) 评论(0) 推荐(0) 编辑

hdu2896 输出可以匹配串的id(AC自动机)

摘要: end数组表示id,开一个used数组记录哪些被匹配过 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int used[505]; 7 struct AC 8 { 9 int next[... 阅读全文

posted @ 2015-02-03 20:12 xiao_xin 阅读(106) 评论(0) 推荐(0) 编辑

hdu2222 输出可以匹配串数目 (附AC自动机模板)

摘要: 裸ac自动机,end数组表示以其结尾的数目 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 struct AC 7 { 8 int next[500020][26],fail[500020],end[500... 阅读全文

posted @ 2015-02-03 20:08 xiao_xin 阅读(120) 评论(0) 推荐(0) 编辑

导航