随笔分类 - 字符串处理---hash
摘要:2124: 等差子序列 Description 给一个1到N的排列{Ai},询问是否存在1<=p1<p2<p3<p4<p5<…<pLen<=N (Len>=3), 使得Ap1,Ap2,Ap3,…ApLen是一个等差序列。 给一个1到N的排列{Ai},询问是否存在1<=p1<p2<p3<p4<p5<…
阅读全文
摘要:One of Arkady's friends works at a huge radio telescope. A few decades ago the telescope has sent a signal s s towards a faraway galaxy. Recently they
阅读全文
摘要:3207: 花神的嘲讽计划Ⅰ Description 背景 花神是神,一大癖好就是嘲讽大J,举例如下: “哎你傻不傻的!【hqz:大笨J】” “这道题又被J屎过了!!” “J这程序怎么跑这么快!J要逆袭了!” …… 描述 这一天DJ在给吾等众蒟蒻讲题,花神在一边做题无聊,就跑到了一边跟吾等众蒟蒻一起
阅读全文
摘要:You are given a string ss. You should answer nn queries. The ii-th query consists of integer kiki and string mimi. The answer for this query is the mi
阅读全文
摘要:You have been offered a job in a company developing a large social network. Your first task is connected with searching profiles that most probably be
阅读全文
摘要:题意:给定字符串char[],以及Q个操作,操作有三种: 1:pos,chr:把pos位置的字符改为chr 2:pos:问以pos为中心的回文串长度为多长。 3:pos:问以pos,pos+1为中心的回文串长度为多长。 思路:用hash表示一段字符串或者连续子串。我们用BIT记录hash前缀和,那么
阅读全文
摘要:After the war, the supersonic rocket became the most common public transportation. Each supersonic rocket consists of two "engines". Each engine is a
阅读全文
摘要:题意:取出字符串Str里的两个串S,T,问对应位置的的字符在否有一一映射关系。 hash:对于每个字符s=‘a’-‘z’,我们任意找一个i,满足Si==s,(代码里用lower_bound在区间找到最小的位置i)其对应的字符为Ti==t。然后我们判断这段区间里s的hash值是否等于t的hash值。不
阅读全文
摘要:Dima adds letters s1, …, sn one by one to the end of a word. After each letter, he asks Misha to tell him how many new palindrome substrings appeared
阅读全文
摘要:题目:CodeForces196-D:The Next Good String 题意:给定仅由小写字母组成的字符串S和一个正整数m。求一个长度与S相同的仅由小写字母组成的字符串S1,满足: S1的字典序>S的字典序 S1中不含长度大于等于d的回文串。 思路:许昊然的文章里叫“逐位确定法”,以为之前没
阅读全文
摘要:Rubik is very keen on number permutations. A permutation a with length n is a sequence, consisting of n different numbers from 1 to n. Element number
阅读全文
摘要:时间限制:4000ms 单点时限:4000ms 内存限制:256MB 时间限制:4000ms 单点时限:4000ms 内存限制:256MB 描述 你知道KMP吗?它是用于判断一个字符串是否是另一个字符串的子串的算法。今天我们想去扩展它。 在信息理论中,在两个相同长度的字符串之间的海明码距离是:两个字
阅读全文
摘要:给定一个字符串S,请统计S的所有子串中,有多少个本质不同的回文字符串? 注意如果两个位置不同的子串满足长度相同且对应字符也都相同,则认为这两个子串本质上是相同的。 Input 一个只包含小写字母的字符串S。 对于30%的数据,S长度不超过100。 对于60%的数据,S长度不超过1000。 对于100
阅读全文