#include<stdio.h>
#include<string.h>
struct tt{
char str[25];
long m;
long total;
long b[10];
};
int main()
{
long N,M,G;
long score[15];
int i,j,l;
struct tt stu[1000],temp;
while(scanf("%ld",&N)!=EOF)
{
if(N==0) break;
scanf("%ld%ld",&M,&G);
for(i=0;i<1000;i++)
stu[i].total=0;
l=0;
for(i=1;i<=M;i++)
scanf("%ld",&score[i]);
for(i=0;i<N;i++)
{
scanf("%s%ld",&stu[i].str,&stu[i].m);
for(j=0;j<stu[i].m;j++)
{
scanf("%ld",&stu[i].b[j]);
stu[i].total+=score[stu[i].b[j]];
}
}
for(i=0;i<N;i++)
{
for(j=i;j<N;j++)
{
if(stu[i].total<stu[j].total)
{
temp=stu[i];
stu[i]=stu[j];
stu[j]=temp;
}
if(stu[i].total==stu[j].total)
{
if(strcmp(stu[i].str,stu[j].str))
{
temp=stu[i];
stu[i]=stu[j];
stu[j]=temp;
}
}
}
}//二级排序
for(i=0;i<N;i++)
{
if(stu[i].total>=G)
l++;
}
printf("%ld\n",l);
for(i=0;i<l;i++)
{
printf("%s %ld\n",stu[i].str,stu[i].total);
}
}
return 0;
}
/*
4 5 25
10 10 12 13 15
CS004 3 5 1 3
CS003 3 2 3 5
CS002 3 5 3 1
CS001 3 2 3 5
*/
hdoj 1236 排名
最新推荐文章于 2017-12-06 09:37:57 发布