随笔分类 -  AC 自动机

HDOJ 2896 病毒侵袭
摘要:WA;这道题题意不清晰,单词相互包含的要不要计算?网上AC的程序跑出来的结果都不太一样,我的是计算在内的。 1 # include <cstdio> 2 # include <cstring> 3 # include <queue> 4 # include <algorithm> 5 6 using namespace std; 7 8 # define WORD_LEN 200 + 5 9 # define TEXT_LEN 10000 + 5 10 # define ALPHA_SIZE 128 + 5 11 12 int n, m, tot 阅读全文

posted @ 2012-08-01 13:40 getgoing 阅读(201) 评论(0) 推荐(0)

HDOJ 2222 Keywords Search
摘要:Accepted2222593MS30816K2430 BG++第一道 AC 自动机,理解了就好写;需要注意字典可能重复,重复的不能按一次算。# include <cstdio># include <cstring># include <queue>using namespace std;# define WORD_LEN 50 + 5# define MAXN 10000 + 5# define ALPHA_SIZE 26int n, id;char t[1000000 + 10];char w[MAXN][WORD_LEN];struct node{ n 阅读全文

posted @ 2012-08-01 11:41 getgoing 阅读(387) 评论(0) 推荐(0)

导航