#P3879. [TJOI2010] 阅读理解
[TJOI2010] 阅读理解
Description
The English teacher assigned reading-comprehension passages. Each passage contains many unfamiliar words that would require checking a dictionary. To save time, we want to collect statistics to determine in which passages certain words appear.
Input Format
The first line contains an integer , the number of passages. Each passage contains only spaces and lowercase letters.
The next lines each describe one passage. Each line begins with an integer , the number of words in that passage. Then follow words, separated by a single space.
Then an integer follows, the number of queries. After that, there are lines, each containing one word to query.
Output Format
For each query word, output one line listing the indices of the passages in which it appears, in ascending order, without duplicates. Indices are separated by a single space (note that there should be no space before the first index or after the last index). If the word never appears, output an empty line.
3
9 you are a good boy ha ha o yeah
13 o my god you like bleach naruto one piece and so do i
11 but i do not think you will get all the points
5
you
i
o
all
naruto
1 2 3
2 3
1 2
3
2
Hint
For of the testdata, .
For of the testdata, , .
Each passage length (including spaces between adjacent words) characters, and each word length characters.
Thanks to @钟梓俊 for adding a set of testdata.
Translated by ChatGPT 5
京公网安备 11011102002149号