简单题。

#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. 如何更改mysql可执行路径及更改mysql数据库文件路径

    一.如何更改服务中MySQL的可执行文件路径: 解决方法:到注册表里HKEY_LOCAL_MECHINE---SYSTEM ---CurrentControlSet 更改查找一. MySQL项值,然后 ...

  2. hdu_5775_Bubble Sort(树状数组)

    题目链接:hdu_5775_Bubble Sort 题意: 让你找每一个数在冒泡排序中最右边和最左边的位置的差值 题解: 还是官方题解,讲的已经很清楚了 1012 Bubble Sort 考虑一个位置 ...

  3. linux top 命令---VIRT,RES,SHR,虚拟内存和物理内存(

    VIRT,RES,SHR,虚拟内存和物理内存(转) VIRT: 1.进程"需要的"虚拟内存大小,包括进程使用的库.代码.数据,以及malloc.new分配的堆空间和分配的栈空间等: ...

  4. easyui datagrid deleteRow(删除行)的BUG!

    转自:http://my.oschina.net/fants/blog/77189项目中又用到easyui 的datagrid做数据展示.功能很强大,很实用,但bug也很多.今天这个就够让人头疼. 如 ...

  5. byte数组与int,long,short,byte转换 (转载)

    byte数组和short数组转换 public short bytesToShort(byte[] bytes) { return ByteBuffer.wrap(bytes).order(ByteO ...

  6. MyEclipse 2015 如何使项目能够使用 Hibernate自动生成文件

    在MyEclipse-Project facets 下 对hibernate这一栏打钩即可

  7. html 页面视图中的资源文件(css/js/image)的路径问题。

    说到html 页面视图中的资源文件的路径引用问题,这个问题以前一直没去弄明白.今天,我将公司新开发的一个项目完全移植到我本地搭建的php 环境中来,遇到了这个问题,想了一下,然后也不是很困难的就把它给 ...

  8. C++ 学习之函数重载、基于const的重载

    函数重载 函数重载的定义是:在相同的作用域中,如果函数具有相同名字而仅仅是形参表不同,此时成为函数重载.注意函数重载不能基于不同的返回值类型进行重载. 注意函数重载中的"形参表"不 ...

  9. Android OpenGL ES(七)基本几何图形定义 .

    在前面Android OpenGL ES(六):创建实例应用OpenGLDemos程序框架 我们创建了示例程序的基本框架,并提供了一个“Hello World”示例,将屏幕显示为红色. 本例介绍Ope ...

  10. input内文字点击消失 弹出层,可以写表单

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...