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;
}
/**/

 

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-01 11:47
点赞 评论 收藏
分享
05-19 15:21
已编辑
华南农业大学 Java
白火同学:你才沟通了200,说实话,北上广深杭这里面你连一座城市的互联网公司都没投满呢,更别说还有各种准一线二线城市了。等你沟通突破了三位数,还没结果再考虑转行的事吧。
点赞 评论 收藏
分享
Java抽象带篮子:简历怎么写可以看看我发的帖子,你的第一个是实习经历吗?那怎么写的是你的第一个练手项目呢?简历写的怎么样直接投小厂面试一下就知道了
没有实习经历,还有机会进...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务