#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+10;
vector<int>stu[maxn];
int hashT(char s[])
{
int ans=0;
for(int i=0;i<3;i++)ans=ans*26+s[i]-'A';
ans=ans*10+s[3]-'0';
return ans;
}
int main()
{
int k,n;
scanf("%d%d",&n,&k);
while(k--)
{
int index,cnt;
scanf("%d%d",&index,&cnt);
char s[10];
while(cnt--)
{
scanf("%s",s);
int num=hashT(s);
stu[num].push_back(index);
}
}
while(n--)
{
char s[10];
scanf("%s",s);
int num=hashT(s);
sort(stu[num].begin(),stu[num].end());
printf("%s %d",s,stu[num].size());
for(int i=0;i<stu[num].size();i++)printf(" %d",stu[num][i]);
printf("\n");
}
return 0;
}
1039 Course List for Student(25 分)
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- char和int的映射,使用name[maxn][20]数组,这个题目因为名字没有重复出现,直接映射就可以 (之前...
- 题目描述 浙江大学有40000个学生,并开2500门课,给出所有课程的学生列表,输出每个学生的课程列表 输入 第一...