-->
当前位置:首页 > 题库

PROGRAMMING:Print students' course selection list

Luz5年前 (2021-05-10)题库373
Suppose the school has up to 40000 students and up to 2500 courses. Now, the list of students for each course is given. It is required to output the list of students for each course.
###Input format:
The first line of input is two positive integers: n ($$$Le $$40000), which is the total number of students who come to query the timetable; K ($$$Le $$2500) is the total number of courses. After that, the list of students from course 1 to K is given in order. The format is: for each course, first output the course number (from 1 to K for simplicity) and the total number of students (separated by a space) in one line, then give the list of students in the second line, and separate the names of two adjacent students with a space. The student's name is composed of 3 capital letters and 1 digit. After the course selection information, the names of n students who come to query the timetable are given in one line, and the names of two adjacent students are separated by a space.
###Output format:
For each student who comes to query the timetable, first output his name, then output a positive integer C in the same line, representing the number of courses selected by the student, and then output the number of C courses in increasing order. The adjacent data is separated by a space. Note that no extra space can be output at the end of the line.
###Input example:
```in
10 5
1 4
ANN0 BOB5 JAY9 LOR6
2 7
ANN0 BOB5 FRA8 JAY9 JOE4 KAT3 LOR6
3 1
BOB5
4 7
BOB5 DON2 FRA8 JAY9 KAT3 LOR6 ZOE1
5 9
AMY7 ANN0 BOB5 DON2 FRA8 JAY9 KAT3 LOR6 ZOE1
ZOE1 ANN0 BOB5 JOE4 JAY9 FRA8 DON2 AMY7 KAT3 LOR6
```
###Output example:
```out
ZOE1 2 4 5
ANN0 3 1 2 5
BOB5 5 1 2 3 4 5
JOE4 1 2
JAY9 4 1 2 4 5
FRA8 3 2 4 5
DON2 2 4 5
AMY7 1 5
KAT3 3 2 4 5
LOR6 4 1 2 4 5
```






answer:If there is no answer, please comment