简单题。

#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. Chapter 1 First Sight——37

    "Never mind, then," he said hastily in a voice like velvet. 别介意,他用天鹅绒般的声音急切的说道 "I can ...

  2. MQL5 获取最后一单 利润

    ///x 最后几单 double getLastProfit(int x) { HistorySelect(,TimeCurrent()); double profit ; long ticket ; ...

  3. svn revert

    本地开发环境出现一个问题,用revert完美解决. 问题描述: 文件static/image/common/jiqiaodaren.png已经被提交到svn上,但是我的开发环境因未与svn同步,所以没 ...

  4. CentOS7 PostgreSQL 安装

    PostgreSQL安装 安装使用yum安装 (找源 http://yum.postgresql.org/) yum install https://download.postgresql.org/p ...

  5. 如何创建自定义ASP.NET MVC5脚手架模板?

    I'm using ASP.NET MVC5 and VS2013 I've tried to copy CodeTemplates folder from C:\Program Files (x86 ...

  6. 编写Linux/Unix守护进程

    原文: http://www.cnblogs.com/haimingwey/archive/2012/04/25/2470190.html 守护进程在Linux/Unix系统中有着广泛的应用.有时,开 ...

  7. ReactiveCocoa / RxSwift 笔记一

    原创:转载请注明出处 ReactiveCocoa / RxSwift Native app有很大一部分的时间是在等待事件发生,然后响应事件,比如 1.等待网络请求完成, 2.等待用户的操作, 3.等待 ...

  8. python 对比图片相似度

    最近appium的使用越来越广泛了,对于测试本身而言,断言同样是很重要的,没有准确的断言那么就根本就不能称之为完整的测试了.那么目前先从最简单的截图对比来看.我这里分享下python的图片相似度的代码 ...

  9. Basically Speaking

    Basically Speaking Time Limit: 2 Sec  Memory Limit: 200 MB Submit: 19  Solved: 11 [Submit][Status][W ...

  10. 多校 Babelfish

    题目链接:http://acm.hust.edu.cn/vjudge/contest/124435#problem/A 密码:acm Sample Input dog ogday cat atcay ...