简单题。

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<map>
#include<queue>
#include<string>
#include<vector>
using namespace std; const int maxn=+; struct X
{
char name[];
vector<int>v;
}s[maxn]; struct Ans
{
vector<int>v;
}ans[maxn]; bool cmp1(const X&a,const X&b)
{
return strcmp(a.name,b.name)<;
} int n,m; int main()
{
scanf("%d%d",&n,&m);
for(int i=;i<=n;i++)
{
scanf("%s",s[i].name);
int num; scanf("%d",&num);
while(num--)
{
int id; scanf("%d",&id);
s[i].v.push_back(id);
}
} sort(s+,s++n,cmp1); for(int i=;i<=n;i++)
for(int j=;j<s[i].v.size();j++)
ans[s[i].v[j]].v.push_back(i); for(int i=;i<=m;i++)
{
printf("%d %d\n",i,ans[i].v.size());
for(int j=;j<ans[i].v.size();j++)
printf("%s\n",s[ans[i].v[j]].name);
}
return ;
}

PAT (Advanced Level) 1047. Student List for Course (25)的更多相关文章

  1. PAT 解题报告 1047. Student List for Course (25)

    1047. Student List for Course (25) Zhejiang University has 40000 students and provides 2500 courses. ...

  2. PAT (Advanced Level) Practise - 1094. The Largest Generation (25)

    http://www.patest.cn/contests/pat-a-practise/1094 A family hierarchy is usually presented by a pedig ...

  3. PAT (Advanced Level) Practice 1036 Boys vs Girls (25 分)

    This time you are asked to tell the difference between the lowest grade of all the male students and ...

  4. PAT (Advanced Level) 1102. Invert a Binary Tree (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  5. PAT (Advanced Level) 1098. Insertion or Heap Sort (25)

    简单题.判断一下是插排还是堆排. #include<cstdio> #include<cstring> #include<cmath> #include<ve ...

  6. PAT (Advanced Level) 1067. Sort with Swap(0,*) (25)

    只对没有归位的数进行交换. 分两种情况: 如果0在最前面,那么随便拿一个没有归位的数和0交换位置. 如果0不在最前面,那么必然可以归位一个数字,将那个数字归位. 这样模拟一下即可. #include& ...

  7. PAT (Advanced Level) 1066. Root of AVL Tree (25)

    AVL树的旋转.居然1A了.... 了解旋转方式之后,数据较小可以当做模拟写. #include<cstdio> #include<cstring> #include<c ...

  8. PAT (Advanced Level) 1055. The World's Richest (25)

    排序.随便加点优化就能过. #include<iostream> #include<cstring> #include<cmath> #include<alg ...

  9. PAT (Advanced Level) 1082. Read Number in Chinese (25)

    模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

随机推荐

  1. thinkphp整合系列之短信验证码、订单通知

    现在这个短信通知泛滥的年代:应用如果没有个短信注册:你都不敢说你是搞开发的: 这个验证码搞起来是不难的:但是如果刚接触也是有点不知从哪下手的迷茫: 先讲下概念: 要想发送验证码:需要至少三项:appi ...

  2. JavaScript高级程序设计:第十四章

    第十四章 一.表单的基础知识 在HTML中,表单是由<form>元素来表示的,而在javascript中,表单对应的则是HTMLFormElement类型.HTMLFormElement继 ...

  3. hdu_2955_Robberies(01背包)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2955 题意:给一个概率p和n个银行,每个银行有一些钱和被抓的概率,问在满足被抓的概率在p以下,抢到的最 ...

  4. linux下base命令

    查看base那么命令的帮助: root@OpenWrt:/# basename --help BusyBox v1.22.1 (2015-09-15 16:38:30 CST) multi-call ...

  5. Entity Framework教程

    随着Code First一起出现的DbContext和DbSet类绝对可以称得上EF的功能核心,其取代了之前的ObjectContext和ObjectSet类,提供了与数据库通信,管理内存中实体的重要 ...

  6. vertor容器

    头文件#include<vector> 1.创建vector对象 1.不指定容器大小  vector <int> v; 2.指定容器大小 vector <double&g ...

  7. flash 右键菜单隐藏与修改

    来源:http://blog.sina.com.cn/s/blog_7264c84401014fmd.html import flash.ui.ContextMenu;import flash.ui. ...

  8. 把aspx页面输出成xml的方法注意事项

    先贴代码 Response.Charset = "gb2312"; Response.ContentType = "text/xml"; Response.Co ...

  9. 确定当前Python环境中的site-packages目录位置

    引入“搜索路径”这个概念是因为在使用import语句时,当解释器遇到import语句,如果模块在当前的搜索路径就会被导入. 搜索路径是一个解释器会先进行搜索的所有目录的列表. 那么python如何添加 ...

  10. ios中关于UIImagePickerController的一些知识总结

    记得添加MobileCoreServices.framework 及导入#import <MobileCoreServices/MobileCoreServices.h> @interfa ...