点击此处即可传送到 hdu 1247 **Hat’s Words**Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.
You are t...
分类:
其他好文 时间:
2015-08-11 18:43:53
阅读次数:
112
统计难题Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 24521Accepted Submission(s): 10133Problem Des...
分类:
其他好文 时间:
2015-08-11 17:52:04
阅读次数:
165
ACM 所有算法
数据结构
栈,队列,链表
哈希表,哈希数组
堆,优先队列
双端队列
可并堆
左偏堆
二叉查找树
Treap
伸展树
并查集
集合计数问题
二分图的识别
平衡二叉树
二叉排序树
线段树
一维线段树
二维线段树
树状数组
一维树状数组
N维树状数组
字典树
后缀数组,后缀树
块状链表
哈夫曼树
桶,跳跃表...
分类:
编程语言 时间:
2015-08-11 16:13:16
阅读次数:
357
代码:#include
#include
#include
using namespace std;
struct Node
{
int cnt;
Node * next[26];
void init()
{
cnt=0;
for(int i=0; i<26; i++)
{
next[i]=N...
分类:
其他好文 时间:
2015-08-11 14:09:48
阅读次数:
122
计算机网络没学好,比赛的时候脑子一抽题意理解错了,赛后自己写了1A,内流满面。。。。
和一般的trie不太一样,这里的trie每个节点开一个vector存网络的id
恩,就这样,跑的挺快的 78ms
#include
#include
#include
#include
#include
#include
#include
#define LL long long
using namespa...
分类:
其他好文 时间:
2015-08-10 22:23:12
阅读次数:
136
前缀树TrieTrie可理解为一个能够快速插入与查询的集合,无论是插入还是查询所需时间都为O(m)模板如下: 1 const int maxnode = 1000+10; 2 const int sigma_size = 26; 3 4 struct Trie{ 5 int ch[maxnode.....
分类:
其他好文 时间:
2015-08-10 21:34:28
阅读次数:
130
单词默写
★☆ 输入文件:engzam.in 输出文件:engzam.out 简单对比
时间限制:1 s 内存限制:128 MB
【问题描述】
小D前一段日子刚刚参加了一次非常苛刻的英语考试。
考试不仅包括了听力、选择、填空等基本题型,还包括了一种特殊的单词默写题。这类题目都是按照以下形式给出的:
在本学期你所学的所有前缀是B的单词中,在课本中出现次数不...
分类:
其他好文 时间:
2015-08-10 13:42:37
阅读次数:
123
借用LeetCode 208. Implement Trie (Prefix Tree)中设计的字典树,特判查询字符为.时的情况即可。
注意:
成员变量的初始化应放在构造函数的initializing list而不是body中,使成员变量只被初始化一次,没有被再次赋值;
使用shared_ptr代替裸指针来管理内存。
代码:
class TrieNode
{
public:
T...
分类:
其他好文 时间:
2015-08-10 12:06:32
阅读次数:
117
要学会AC自动机,我们必须知道什么是Trie,也就是字典树。最好对KMP算法也有些了解。Trie树和KMP算法我之前博客都有写过,感兴趣的可以看看。
简单叙述下问题,现在给出
"hsay";
"ah";
"sahe";
"he";
"say";
"herhb";
"aher";
"erhs"
共8个关键词,要问字符串"yasaherhsay"中这8个关键词有几个出现过。...
分类:
其他好文 时间:
2015-08-10 01:57:56
阅读次数:
121
题意:给一组单词 开始提问每次给一个串求该串是上面几个单词的前缀分析:没给数据规模,但用链表写ME好几次,又用数组写开小RE了,试了几次才过了,真是醉了。。。#include #include #include #include #include #include #include #include...
分类:
其他好文 时间:
2015-08-09 18:42:26
阅读次数:
114