摘要:
题意: 给出n个字符串,再给出一个字符串,把之前出现过的字符串全部变成* 思路: AC自动机,Trie树上存的值是一个字符串的长度,也就是往前的长度,然后倒着处理一遍。 感想: 第三题AC自动机,本来就是想脱离模板多练练,虽然之前撒比bug错了一大堆,但是收获很多啊。 重要的感想有两个方面: 一... 阅读全文
摘要:
思路: 因为不同病毒特征码不会相同。 AC自动机,然后对于每一个输出即可。 注意:以上字符串中字符都是ASCII码可见字符(不包括回车);G++ MLE。 //#include #include #include #include #include #include using na... 阅读全文
摘要:
Frist AC zi dong ji(Aho-Corasick Automation) of life #include using namespace std; const int N=5e5+10; //10000个串,长度为50 struct Trie{ int ... 阅读全文
摘要:
ZOJ3321 //there is at most one edge between two nodes. 因为这句话的局限性,又要满足环,那么一定是每个点度为2,然后为n节点的一个环 //#include #include#include#includeusing namespace std... 阅读全文
摘要:
思路: 利用next[]的转化。 //#include #include#include#includeusing namespace std;const int N=1e3+10;char p[N],s[N];int lenp,lens,Next[N];void GetNext(){ i... 阅读全文