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

PROGRAMMING:Print the list of students who choose courses

Luz5年前 (2021-05-10)题库513
Suppose the school has up to 40000 students and up to 2500 courses. Now give each student's course selection list, request output each course's course selection student list.
###Input format:
The first line of input is two positive integers: n ($$$Le $$40000), which is the total number of students in the whole school; K ($$$Le $$2500) is the total number of courses. Then n lines, each line includes a student's name (3 capital letters + 1 digit), a positive integer C ($$$Le $$20) representing the number of courses selected by the student, followed by C course numbers. For simplicity, courses are numbered from 1 to K.
###Output format:
Output the list of students from course 1 to K in sequence. The format is: for each course, first output the course number and the total number of students (separated by spaces) in one line, and then output the list of students in dictionary order in the second line, with each student's name in one line.
###Input example:
```in
10 5
ZOE1 2 4 5
ANN0 3 5 2 1
BOB5 5 3 4 2 1 5
JOE4 1 2
JAY9 4 1 2 5 4
FRA8 3 4 2 5
DON2 2 4 5
AMY7 1 5
KAT3 3 5 4 2
LOR6 4 2 4 1 5
```
###Output example:
```out
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
```






answer:If there is no answer, please comment