#2664. P3277 - [TJOI2010] 阅读理解 - JOYSKID

P3277 - [TJOI2010] 阅读理解 - JOYSKID

题目描述

英语老师留了 lns="http://www.w3.org/1998/Math/MathML">�N 篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过。

输入格式

第一行为整数 lns="http://www.w3.org/1998/Math/MathML">�N ,表示短文篇数,其中每篇短文只含空格和小写字母。

按下来的 lns="http://www.w3.org/1998/Math/MathML">�N 行,每行描述一篇短文。每行的开头是一个整数 lns="http://www.w3.org/1998/Math/MathML">�L ,表示这篇短文由 lns="http://www.w3.org/1998/Math/MathML">�L 个单词组成。接下来是 lns="http://www.w3.org/1998/Math/MathML">�L 个单词,单词之间用一个空格分隔。

然后为一个整数 lns="http://www.w3.org/1998/Math/MathML">�M ,表示要做几次询问。后面有 lns="http://www.w3.org/1998/Math/MathML">�M 行,每行表示一个要统计的生词。

输出格式

对于每个生词输出一行,统计其在哪几篇短文中出现过,并按从小到大输出短文的序号,序号不应有重复,序号之间用一个空格隔开(注意第一个序号的前面和最后一个序号的后面不应有空格)。如果该单词一直没出现过,则输出一个空行。

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
	对于 lns="http://www.w3.org/1998/Math/MathML">30%30% 的数据, lns="http://www.w3.org/1998/Math/MathML">1≤�≤1031≤M≤103 。

	对于 lns="http://www.w3.org/1998/Math/MathML">100%100% 的数据,lns="http://www.w3.org/1998/Math/MathML">1≤�≤1041≤M≤104,lns="http://www.w3.org/1998/Math/MathML">1≤�≤1031≤N≤103 。

	每篇短文长度(含相邻单词之间的空格)lns="http://www.w3.org/1998/Math/MathML">≤5×103≤5×103 字符,每个单词长度 lns="http://www.w3.org/1998/Math/MathML">≤20≤20 字符。