1039. Course List for Student (25)
时间限制
200 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Zhejiang University has 40000 students and provides 2500 courses. Now giventhe student name lists of all the courses, you are supposed to output the registered course listfor each student who comes for a query.
Input Specification:
Each input filecontains one test case. For each case, thefirst line contains2 positive integers: N (<=40000), thenumberof students who look for their course lists, and K (<=2500), the total numberof courses. Then the student name lists are givenforthe courses (numbered from1to K) inthe following format: for each course i, firstthe course index i andthenumberof registered students Ni (<= 200) are givenin a line. Then inthe next line, Ni student names are given. A student name consists of3 capital English letters plus a one-digit number. Finally thelast line containsthe N names of students who come for a query. All the names and numbers in a line are separated by a space.
Output Specification:
For each test case, print your results in N lines. Each line corresponds to one student, inthe following format: first print the student's name, thenthe total numberof registered courses ofthat student, and finally the indices ofthe courses in increasing order. The query results must be printed inthe same order as input. All the data in a line must be separated by a space, with no extra spaceattheendofthe line.
Sample Input:
11547
BOB5 DON2 FRA8 JAY9 KAT3 LOR6 ZOE1
14
ANN0 BOB5 JAY9 LOR6
27
ANN0 BOB5 FRA8 JAY9 JOE4 KAT3 LOR6
31
BOB5
59
AMY7 ANN0 BOB5 DON2 FRA8 JAY9 KAT3 LOR6 ZOE1
ZOE1 ANN0 BOB5 JOE4 JAY9 FRA8 DON2 AMY7 KAT3 LOR6 NON9
Sample Output:
ZOE1 245
ANN0 3125
BOB5 512345
JOE4 12
JAY9 41245
FRA8 3245
DON2 245
AMY7 15
KAT3 3245
LOR6 41245
NON9 0
题目1039. Course List for Student (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueZhejiang University has 40000 students and provides 2500 courses. Now given the student name list