import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; class Stu{ String sno; int scores; } public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); if(n==0)return; int m=sc.nextInt(); int sco=sc.nextInt(); int []a=new int[m];//分数 for (int j = 0; j < a.length; j++) { a[j]=sc.nextInt(); } Stu []s=new Stu[n];//学生数 for (int i = 0; i <n; i++) { s[i]=new Stu(); s[i].sno=sc.next(); int num=sc.nextInt(); for (int j = 0; j < num; j++) { s[i].scores+=a[sc.nextInt()-1]; } } Arrays.sort(s, new Comparator<Stu>(){ @Override public int compare(Stu o1, Stu o2) { if(o1.scores==o2.scores)return o1.sno.compareTo(o2.sno); return o2.scores-o1.scores; } }); int cnt=0; for (int i = 0; i < s.length; i++) { if(s[i].scores<sco){cnt=i; break;} } System.out.println(cnt); for (int i = 0; i < cnt; i++) { System.out.println(s[i].sno+" "+s[i].scores); } } sc.close(); } }
0.0分
1 人评分