智慧屏 安装 app如何提升家庭娱乐与教育体验的关键工具
876
2022-08-29
bzoj 2780 [Spoj]8093 Sevenk Love Oimaster
Description
Oimaster and sevenk love each other.
But recently,sevenk heard that a girl named ChuYuXun was dating with oimaster.As a woman’s nature, s evenk felt angry and began to check oimaster’s online talk with ChuYuXun. Oimaster talked with Ch uYuXun n times, and each online talk actually is a string.Sevenk asks q questions like this, “how many strings in oimaster’s online talk contain this string as their substrings?” 有n个大串和m个询问,每次给出一个字符串s询问在多少个大串中出现过 Input
There are two integers in the first line, the number of strings n and the number of questions q. And n lines follow, each of them is a string describing oimaster’s online talk. And q lines follow, each of them is a question. n<=10000, q<=60000 the total length of n strings<=100000, the total length of q question strings<=360000 Output
For each question, output the answer in one line.
Sample Input
3 3 abcabcabc aaa aafe abc a ca Sample Output
1 3 1 HINT
Source
鸣谢duan2提供译文
将文本串建广义SAM 然后将询问离线
每次询问相当于一棵子树然后 将询问按照子树的结束节点从小到大排序 然后 一边询问一边做 每次做的时候相当于把我这部分改一下 把我的影响改掉 因为我的子树里不可能有我的贡献了同时再把我的贡献加上 即从上一次这个串出现的位置到这次所在的位置都加上1即可 等到我这个询问的子树里的内容都做完了我直接查询我子树开始的位置的值即可
#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~