#P3269. [JLOI2016] 字符串覆盖
[JLOI2016] 字符串覆盖
Description
String has substrings . If we place each of these substrings at exactly one position where it occurs in (substrings may overlap), then some characters in will be covered by these substrings. Find the minimum and maximum possible numbers of covered characters in .
Input Format
The first line contains a positive integer , the number of test cases. It is guaranteed that .
Then the test cases follow. For each test case:
- The first line contains a string of lowercase letters, the main string .
- The second line contains an integer , the number of substrings.
- The next lines each contain a string of lowercase letters, describing a substring. It is guaranteed that every substring occurs in the main string.
Output Format
Output lines, one for each test case. Each line contains two integers and , the minimum and maximum numbers of characters that can be covered, respectively.
2
hello
4
he
l
l
o
abacaba
4
ab
ba
a
c
4 5
4 6
Hint
Constraints: , , substring length .
Translated by ChatGPT 5
京公网安备 11011102002149号