
ACM_字符串
DATELOST
I'm curious.
展开
-
SPOJ-LCS 后缀自动机
题目求字符串s,p的lcs将s加入sam中遍历p,当前字符u初始结点v=1,长度len=0;如果该结点有u的出边,匹配,++len否则通过fa回跳到能匹配的位置。如果一个也不能匹配,v=1,len=0板子#include<iostream>#include<string.h>#include<stdio.h>#include<mat...原创 2020-01-11 22:40:25 · 211 阅读 · 0 评论 -
ACwing-143. 最大异或对 01字典树
在给定的N个整数A1,A2……AN中选出两个进行xor(异或)运算,得到的结果最大是多少?输入格式第一行输入一个整数N。第二行输入N个整数A1~AN。输出格式输出一个整数表示答案。数据范围1≤N≤10^5,0≤Ai<2^31输入样例:31 2 3输出样例:3每个数看成长度32的二进制01串以最高位为根节点建Trie贪心走相反位代码#include<b...原创 2019-08-09 23:11:53 · 146 阅读 · 0 评论 -
POJ-3693 后缀数组 lcp
DescriptionThe repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same consecutive substrings. For example, the repetition number of “abab...原创 2019-07-17 22:11:29 · 143 阅读 · 0 评论 -
HDU-2896 AC自动机
Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋——我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一。小t如此生气,他决定要把世界上所有带病毒的网站都找出来。当然,谁都知道这是不可能的。小...原创 2019-07-19 00:39:33 · 120 阅读 · 0 评论 -
HDU-2222 AC自动机
Problem DescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to his image retrieval system.Every image have a...原创 2019-07-18 23:46:10 · 118 阅读 · 0 评论 -
POJ-3261 后缀数组 对height分组 二分
DescriptionFarmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can’t predict the quality of milk from o...原创 2019-07-16 14:57:42 · 113 阅读 · 0 评论 -
POJ-2274 最长公共子串 后缀数组
题目DA time—360ms memory—5984k#include<iostream>#include<stdio.h>#include<string.h>#define F(x) ((x)/3+((x)%3==1?0:tb))#define G(x) ((x)<tb?(x)*3+1:((x)-tb)*3+2)using nam...原创 2019-07-15 23:30:33 · 164 阅读 · 0 评论 -
HDU-1880 Hash +STL
Problem Description哈利波特在魔法学校的必修课之一就是学习魔咒。据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助。给你一部魔咒词典。当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能;当哈利需要某个功能但不知道该用什么魔咒时,你的程序要替他找到相应的魔咒。如果他要的魔咒不在词典中,就...原创 2019-07-15 21:04:34 · 117 阅读 · 0 评论 -
HDU-3068 最长回文 Hash
Problem Description给出一个只由小写英文字符a,b,c…y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c…y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度len <= 110000Output每一行一...原创 2019-07-14 21:43:35 · 138 阅读 · 0 评论 -
POJ-2774 最长公共子串 Hash 二分
InputTwo strings with lowercase letters on two of the input lines individually. Number of characters in each one will never exceed 100000.OutputA single line with a single integer number – what is ...原创 2019-07-15 23:30:57 · 237 阅读 · 0 评论 -
POJ-3349 HASH 最小表示法
DescriptionYou may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of snow...原创 2019-07-14 13:34:58 · 157 阅读 · 0 评论 -
POJ-275 Hash/Kmp
DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same ...原创 2019-04-24 10:32:38 · 174 阅读 · 0 评论 -
HDU-3746 KMP求循环节
Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and t...原创 2019-04-22 22:02:14 · 130 阅读 · 0 评论 -
HDU-1711 KMP算法的运用
Problem Description:Given two sequences of numbers : a[1], a[2], … , a[N], and b[1], b[2], … , b[M] (1 &lt;= M &lt;= 10000, 1 &lt;= N &lt;= 1000000). Your task is to find a number K which make a[K] =...原创 2019-01-26 19:50:14 · 299 阅读 · 0 评论 -
UVA-156 hash的运用
题目Sample Inputladder came tape soon leader acme RIDE lone Dreis peatScAlE orb eye Rides dealer NotE derail LaCeS drIednoel dire Disk mace Rob dries #Sample OutputDiskNotEderaildrIedeyeladde...原创 2019-01-23 14:51:43 · 133 阅读 · 0 评论