3037: 【普及+/提高】【P3879】阅读理解

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

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

输入

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

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

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

输出

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

样例输入 复制

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

提示

对于 lns="http://www.w3.org/1998/Math/MathML">30% 的数据, lns="http://www.w3.org/1998/Math/MathML">1103 。

对于 lns="http://www.w3.org/1998/Math/MathML">100% 的数据,lns="http://www.w3.org/1998/Math/MathML">1104lns="http://www.w3.org/1998/Math/MathML">1103 。

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

每个测试点时限 lns="http://www.w3.org/1998/Math/MathML">2 秒。