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 minimum length of such a string tt that tt is a substring of ss and mimi has at least kiki occurrences…
Problem   Codeforces #541 (Div2) - E. String Multiplication Time Limit: 2000 mSec Problem Description Input Output Print exactly one integer — the beauty of the product of the strings. Sample Input 3aba Sample Output 3 题解:这个题的思维难度其实不大,需要维护什么东西很容易想到,或…
题意 题目链接 Sol Orz jry 和上一个题一个思路吧,直接bitset乱搞,不同的是这次有了修改操作 因为每次修改只会改两个位置,直接暴力改就好了 #include<bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; char s[MAXN], tmp[MAXN]; int N, q; bitset<MAXN> ans, B[27]; main() { scanf("%s %d",…
http://codeforces.com/contest/963/problem/D 题解:https://www.cnblogs.com/Blue233333/p/8881614.html 记M为n个串的总长,L为s的长度 询问串的不同的长度只会有sqrt(M)级别个 (最差的情况是串长为1,2,3,...,x,此时M=(x+1)x/2,因此x是sqrt(M)级别的) s的子串中,长度为特定值k的子串个数是L级别的, 由于各个字符串互不相同,这就相当于n个串中所有长度为k的串,分别计算出它们…
[题目]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),…
C. Page Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «Bersoft» company is working on a new version of its most popular text editor - Bord 2010. Bord, like many other text editor…
题意:有一个串s,n个串模式串t,问s的子串中长度最小的包含t k次的长度是多少 题解:把所有t建ac自动机,把s在ac自动机上匹配.保存每个模式串在s中出现的位置.这里由于t两两不同最多只有xsqrt(x),x是总长度.然后双指针扫一遍即可 这里有一个很重要的优化技巧,由于ac自动机上不是每个点都是t的结尾,我们把fail向上跳一次变成直接跳到t的结尾,build预处理一下 //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragm…
"Cricket Field" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100002 Description Once upon a time there was a greedy King who ordered his chief Architect to build a field for royal cricket inside his park. The King was so…
You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed, on each of them you concatenate two existing strings into a new one. On the i-th operation the concatenation saisbi is saved into a new string sn + …
GT and set  Accepts: 35  Submissions: 194  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 有NN个集合,每个集合中有A_iA​i​​个数. 你要将这NN个集合划成LL个部分,使得每个部分的集合至少有一个共有的数. 如果至少有一个解输出YESYES,否则输出NONO 输入描述 第一行一个数T表示数据组数.(TT\leq≤2020)…