A. Hongcow Learns the Cyclic Shift 题目连接: http://codeforces.com/contest/745/problem/A Description Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how t
BZOJ3926&&lg3346 ZJOI诸神眷顾的幻想乡(广义后缀自动机) 题面 自己找去 HINT 我们可以把题目拆解成几个部分,首先我们手玩一个结论,从所有的叶子节点出发,遍历整颗树,这里面一定包括了所有的文本串,既然如此,就上广义后缀自动机维护,然后本质不同子串个数,也就是\(\sum_{u=2}^{tot}{node[u].len-node[fa].len}\),然后这题就OK了 #include<bits/stdc++.h> using namespace std;
BZOJ3172&&lg3966 TJOI单词(广义后缀自动机) 题面 自己找去 HINT 给出多个文本串,让你查找每个文本串一共出现了多少次,广义后缀自动机建出parent tree然后上推就好了鸭,感觉代码也没有什么细节,写就完事了. #include<bits/stdc++.h> #include<set> using namespace std; const int maxn=200010; inline int read(){ int w=0,f=1; c
Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and made an amazing discovery: there are only 16 types of programming contest problems! Furthermore, the top several comprise almost 80% of the problems s