orzorz 日常%学弟 华科的未来orz
#include <cstdio> #include <cstring> using namespace std;1struct tnode { 2 int s; 3 tnode *f, *w, *c[26]; 4} T[5000000], *Q[5000000]; 5int C;1inline tnode *tnew() { 2 memset(T + C, 0, sizeof(tnode)); 3 return T + C++; 4}1inline void AcaInsert(tnode *p, const char *s) …
阅读更多题意:给出n个模式串,一个文本串,问文本串中出现了多少各模式串。
思路:ac自动机裸题。代码风格来自bin神。静态数组的写法。
需要理解 在build fail的时候,先单独处理root的必要性。
阅读更多