#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector> using namespace std; struct stu {
char id[10];
int sum;
}; int main() { int n, m, g;
while (scanf("%d%d%d", &n, &m, &g), n) {
int tab[m];
for (int i = 0; i < m; ++i) {
scanf(" %d", &tab[i]);
} stu stus[n];
memset(stus, 0, sizeof(stus));
for (int j = 0; j < n; ++j) {
scanf(" %s", stus[j].id);
int t;
scanf(" %d", &t);
for (int i = 0; i < t; ++i) {
int n1;
scanf(" %d", &n1);
stus[j].sum += tab[n1-1];
}
} sort(stus, stus + n, [](const stu &s1, const stu &s2) {
int temp;
temp = s1.sum - s2.sum;
if (temp == 0) {
int t2;
t2 = strcmp(s1.id, s2.id);
return t2 < 0;
} else return temp > 0; }); int x = 0;
for (int k = 0; k < n; ++k) {
if (stus[k].sum >= g) x++;
} printf("%d\n", x); for (int l = 0; l < n; ++l) {
if (stus[l].sum >= g) printf("%s %d\n", stus[l].id, stus[l].sum);
} } return 0;
}

最新文章

  1. Discuz对不起,您安装的不是正版应用的解决办法
  2. django 1.8 TEMPLE_DIR和STATICFILES_DIRS配置
  3. 使用 HTML5 Canvas 绘制出惊艳的水滴效果
  4. win7 64位DCOM配置(关于导出excel 配置计算机组件服务)(转)
  5. 【Android】记录反编译安卓程序步骤
  6. Unity-Tween
  7. 在rails下新建表
  8. Android 进入页面默认定位到ListView的解决方法
  9. poj 2063 Investment
  10. windows同时安装两个jdk
  11. 【Objective-C】4-空指针和野指针
  12. How to convert an IPv4 address into a integer in C#?
  13. Java实现希尔排序
  14. sendto() 向广播地址发包返回errno 13, Permission denied错误
  15. Spring in action (1)
  16. Git托管
  17. element-ui,router.push到其他路由,菜单栏不会高亮对应的路由
  18. javascript正则表达式的一些笔记
  19. cf1073G Yet Another LCP Problem (SA+权值线段树)
  20. 【BZOJ2229】【ZJOI2011】最小割

热门文章

  1. python学习(4)循环语句
  2. spark sql 执行计划生成案例
  3. php 截取字符串长度 并 把超出规定长度的内容用...替代
  4. golang 自定义结构体(与其他语言对象类似)
  5. 终于解决 k8s 集群中部署 nodelocaldns 的问题
  6. phpmyadmin配置文件详解
  7. bootstrap--网格化布局
  8. R语言入门:向量索引
  9. Objective-C编程 — 类和继承
  10. MySQL必知必会--分 组 数 据