
字典树
文章平均质量分 64
Aerolite坠落
这个作者很懒,什么都没留下…
展开
-
Message Flood(字典树)
题目描述 Well, how do you feel about mobile phone? Your answer would probably be something like that "It's so convenient and benefits people a lot". However, If you ask Merlin this question on the New原创 2014-02-18 10:37:11 · 880 阅读 · 0 评论 -
POJ 2513 Colored Sticks(字典树+并查集连通性+欧拉回路)
题目地址:POJ 2513 刚开始没想到字典树,用的map函数一直TLE,由于上一次的签到题由于没想到字典树而卡了好长时间的深刻教训,于是过了不久就想起来用字典树了,(为什么是在TLE了5次之后。。T^T)是在然后把map改成了字典树,然后就过了。 这题居然不知不觉的用上了欧拉回路。。其实当时我是这样想的。。因为相互接触的必须要相同,所以除了两端外,其他的都是两两相同的,所以除了两端的颜色外其原创 2014-07-28 21:04:13 · 1112 阅读 · 0 评论 -
POJ 2001 Shortest Prefixes(字典树)
题目地址:POJ 2001 考察的字典树,利用的是建树时将每一个点只要走过就累加。最后从根节点开始遍历,当遍历到只有1次走过的时候,就说明这个地方是最短的独立前缀。然后记录下长度,输出即可。 代码如下: #include #include #include #include #include #include #include #include #include using原创 2014-07-31 11:03:51 · 1046 阅读 · 0 评论 -
Codeforces Round #311 (Div. 2) E. Ann and Half-Palindrome (DP+字典树)
题目地址:传送门 先用dp求出所有的符合要求的半回文串,标记出来。然后构造字典树。然后再dfs一遍求出所有节点的子树和,最后搜一遍就能找出第k个来了。 代码如下:#include <iostream> #include <string.h> #include <math.h> #include <queue> #include <algorithm> #include <stdlib.h> #i原创 2015-07-02 21:39:06 · 1018 阅读 · 0 评论