A9930 | Mike and Friends
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercase English letters. What is double strange that a phone number can be associated with several bears!
In that country there is a rock band called CF consisting of $n$ bears (including Mike) numbered from $1$ to $n$ .
Phone number of $i$ -th member of CF is $s_{i}$ . May 17th is a holiday named Phone Calls day. In the last Phone Calls day, everyone called all the numbers that are substrings of his/her number (one may call some number several times). In particular, everyone called himself (that was really strange country).
Denote as $call(i,j)$ the number of times that $i$ -th member of CF called the $j$ -th member of CF.
The geek Mike has $q$ questions that he wants to ask you. In each question he gives you numbers $l,r$ and $k$ and you should tell him the number

In that country there is a rock band called CF consisting of $n$ bears (including Mike) numbered from $1$ to $n$ .
Phone number of $i$ -th member of CF is $s_{i}$ . May 17th is a holiday named Phone Calls day. In the last Phone Calls day, everyone called all the numbers that are substrings of his/her number (one may call some number several times). In particular, everyone called himself (that was really strange country).
Denote as $call(i,j)$ the number of times that $i$ -th member of CF called the $j$ -th member of CF.
The geek Mike has $q$ questions that he wants to ask you. In each question he gives you numbers $l,r$ and $k$ and you should tell him the number

输入格式
The first line of input contains integers $n$ and $q$ ( $1<=n<=2×10^{5}$ and $1<=q<=5×10^{5}$ ).
The next $n$ lines contain the phone numbers, $i$ -th line contains a string $s_{i}$ consisting of lowercase English letters ().
The next $q$ lines contain the information about the questions, each of them contains integers $l,r$ and $k$ ( $1<=l<=r<=n$ and $1<=k<=n$ ).
The next $n$ lines contain the phone numbers, $i$ -th line contains a string $s_{i}$ consisting of lowercase English letters ().
The next $q$ lines contain the information about the questions, each of them contains integers $l,r$ and $k$ ( $1<=l<=r<=n$ and $1<=k<=n$ ).
输出格式
Print the answer for each question in a separate line.
输入输出样例
输入 #1
5 5 a ab abab ababab b 1 5 1 3 5 1 1 5 2 1 5 3 1 4 5
输出 #1
7 5 6 3 6
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted