ACM之字符串专题
punchline_skr
会飞的代码
展开
-
D - Phone List(hdu 1671) (字典树)
这道题是在vj上的字典树专题上面看到的,在vj上提交TLE,然后就懵了,怎么会超时呢?!然后在hdu上提交是MTE,原来是没有释放内存空间,然后稍作改动就AC了…… #include<bits/stdc++.h> using namespace std; string s; struct cmp { bool operator()(const string &a...原创 2018-05-31 22:36:14 · 168 阅读 · 0 评论 -
Colored Sticks(poj 2513) (字典树+欧拉回路+并查集)
Time limit 5000 ms Memory limit 128000 kB You are given a bunch of wooden sticks. Each endpoint of each stick is colored with some color. Is it possible to align the sticks in a straight line such...转载 2018-05-18 21:24:44 · 185 阅读 · 0 评论 -
Power Strings(poj 2406) (kmp)
Time limit 3000 ms Memory limit 65536 kB Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenatio...原创 2018-05-18 22:20:33 · 120 阅读 · 0 评论 -
KMP算法模板
输入 3组字符串,每组字符串占一行。每行包含由空格分隔的两个字符串,字符串仅由英文小写字母组成且长度不大于100。 输出 每组数据输出1行,输出后一个字符串在前一个字符串中的位置,如果不匹配,则输出0。 样例输入 string str thisisalongstring isa nosubstring subt 样例输出 1 5 0 参考博客 #include<bit...原创 2018-04-13 16:49:51 · 434 阅读 · 0 评论 -
Period(poj 1961) (kmp)
Time limit 3000 ms Memory limit 30000 kB For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix ...原创 2018-05-18 22:49:33 · 244 阅读 · 0 评论 -
统计难题(hdu 1251) (字典树)
头次接触字典树(可当模板用),解题思路来自 统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 54907 Accepted Submission(s): 19183 Problem Description Igna...原创 2018-05-04 23:50:21 · 172 阅读 · 0 评论 -
Shortest Prefixes (POJ 2001) (字典树)
A - Shortest Prefixes Time limit 1000 ms Memory limit 30000 kB A prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car",...原创 2018-05-30 13:43:20 · 220 阅读 · 0 评论 -
Hat’s Words (hdu 1247) (字典树)
Time limit 1000 ms Memory limit 32768 kB A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find all the hat’s words ...原创 2018-05-30 18:15:53 · 163 阅读 · 0 评论