hdu1236

/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

int n, m, g;
int score[15];
struct node
{
	string name;
	int num;
	int ac[15];
	int sum;
	bool operator <(const node &x)const{
		return sum == x.sum ? name < x.name : sum > x.sum;
	}
}a[1005];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	while(scanf("%d", &n) == 1){
		if(!n) break;
		scanf("%d %d", &m, &g);
		for (int i = 1; i <= m; i++){
			scanf("%d", &score[i]);
		}
		for (int i = 1; i <= n; i++){
			cin >> a[i].name >> a[i].num;
			int num;
			a[i].sum = 0;
			for (int j = 1; j <= a[i].num; j++){
				scanf("%d", &num);
				a[i].sum += score[num];
			}
		}
		sort(a + 1, a + 1 + n);
		int ans = 0;
		for (int i = 1; i <= n; i++){
			if(a[i].sum >= g) ans++;
			else break;
		}
		printf("%d\n", ans);
		for (int i = 1; i <= ans; i++){
			cout << a[i].name << " " << a[i].sum << endl;
		}
	}

	return 0;
}
/**/

 

全部评论

相关推荐

11-08 13:58
门头沟学院 Java
程序员小白条:竟然是蓝桥杯人才doge,还要花钱申领的offer,这么好的公司哪里去找
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务