http://codeforces.com/contest/1029/problem/A You are given a string tt consisting of nn lowercase Latin letters and an integer number kk. Let's define a substring of some string ss with indices from ll to rr as s[l…r]s[l…r]. Your task is to construct…
[题目]F. Substrings in a String [题意]给定小写字母字符串s,支持两种操作:1.修改某个位置的字符,2.给定字符串y,查询区间[l,r]内出现y多少次.|s|,Σ|y|<=10^5,time=6s. [算法]Bitset [题解]假设S的长度为n,那么对每个字符建一个长度为n的bitset,1表示该位置为该字符,修改时直接修改. 查询的时候将字符串y所有的字符的bitset,按顺序错位and,这样最后得到1表示y为子串,count一下即可. 复杂度O(n^2/32),…
题目如下: You are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of t costs |s[i] - t[i]| that is, the absolute difference between the ASCII values of the characters. You are al…