会员登录 用户名: 密码: 登录 新会员注册 [找回密码]
当前位置:编程论坛 >> 日常事务管理 >> 政务大厅 >> 新手积分资助计划 - 宣传网站赢取积分(每点击一次奖20积分)
首页
  发表一个新主题  发表一个新投票  回复主题 您是本帖的第 110231 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
 * 贴子主题:新手积分资助计划 - 宣传网站赢取积分(每点击一次奖20积分) 报告本帖给版主  显示可打印的版本  把本贴打包邮递  把本贴加入论坛收藏夹  发送本页面给朋友  把本贴加入IE收藏夹 
 shjingjing 美女呀,离线,快来找我吧!金牛座1986-4-25
  
  
  等 级:初出江湖
  积 分:219
  专家分:0
  提问帖:0/0
  回答帖:1
  总帖数:10
  经验值:36
  注 册:2008-4-27
给shjingjing发送一个短消息 把shjingjing加入好友 查看shjingjing的个人资料 搜索shjingjing在政务大厅的所有贴子 引用回复这个贴子 回复这个贴子301

发贴心情 

    How to earn more
Xiao Ming is an expert in computer science and technology, so he can get a lot of projects 

every month. The projects always bring him a lot of money, now he is thinking how to earn 

money as more as possible.

Every month he can get m projects, and each project Ai will bring him Xi yuan. Although Xiao 

Ming is an expert, he still needs to hire some other guys to help him. Of course, the 

employees are not as good as Xiao Ming, for they are just good at some single aspect. So, 

they should work together to finish one project. There is a list shows the salary of m 

employees, who are labeled from 0 to m-1. Xiao Ming only hires employees, in that list, and 

he knows who will be needed by each project.If one employee is hired, he can join in several 

projects. 


Input

The first line is an integer c shows the number of cases. For each case, the first line has 

two numbers m,n(m,n <=100), denoting that there is m projects and n employees on the 

list.The second line has m integers, which are seperated by a single blank, the ith number 

Ximeans the project Ai will bring Xiao Ming Xi yuan. Xi is less the 10000. The third line 

has n integers, which are seperated by a single blank, the ith number Yimeans the employee 

Bi will cost Xiao Ming Xi yuan. And the next m lines will show which part of the employees 

will be needed by each project. Line i is a list of the employees, who are needed by project 

Ai. In each line, first a number Zi shows the number of employees needed by this project. 

And Zi labels of the emloyees follows, which are still seperated by a sigle blank. 


Output

You should output a single integer shows the maximun money Xiao Ming can earn in a single 

month. The money he can earn is equall to the money he can totally get minus the money he 

totally cost. You should not leave any extra blanks at the end of each line. 

Sample Input


1
3 5
30 40 43
55 17 23 22 11
3 0 1 2
3 1 2 3
2 2 1

Sample Output


21

Hint

If Xiao Ming can do less project to earn more money, he will certainly do that.


我很美!

发帖:2008-4-27 12:37:00
 shjingjing 美女呀,离线,快来找我吧!金牛座1986-4-25
  
  
  等 级:初出江湖
  积 分:219
  专家分:0
  提问帖:0/0
  回答帖:1
  总帖数:10
  经验值:36
  注 册:2008-4-27
给shjingjing发送一个短消息 把shjingjing加入好友 查看shjingjing的个人资料 搜索shjingjing在政务大厅的所有贴子 引用回复这个贴子 回复这个贴子302

发贴心情 

各位哥哥们,帮帮我啊!用C或C++都可以!    
How to earn more
Xiao Ming is an expert in computer science and technology, so he can get a lot of projects 

every month. The projects always bring him a lot of money, now he is thinking how to earn 

money as more as possible.

Every month he can get m projects, and each project Ai will bring him Xi yuan. Although Xiao 

Ming is an expert, he still needs to hire some other guys to help him. Of course, the 

employees are not as good as Xiao Ming, for they are just good at some single aspect. So, 

they should work together to finish one project. There is a list shows the salary of m 

employees, who are labeled from 0 to m-1. Xiao Ming only hires employees, in that list, and 

he knows who will be needed by each project.If one employee is hired, he can join in several 

projects. 


Input

The first line is an integer c shows the number of cases. For each case, the first line has 

two numbers m,n(m,n <=100), denoting that there is m projects and n employees on the 

list.The second line has m integers, which are seperated by a single blank, the ith number 

Ximeans the project Ai will bring Xiao Ming Xi yuan. Xi is less the 10000. The third line 

has n integers, which are seperated by a single blank, the ith number Yimeans the employee 

Bi will cost Xiao Ming Xi yuan. And the next m lines will show which part of the employees 

will be needed by each project. Line i is a list of the employees, who are needed by project 

Ai. In each line, first a number Zi shows the number of employees needed by this project. 

And Zi labels of the emloyees follows, which are still seperated by a sigle blank. 


Output

You should output a single integer shows the maximun money Xiao Ming can earn in a single 

month. The money he can earn is equall to the money he can totally get minus the money he 

totally cost. You should not leave any extra blanks at the end of each line. 

Sample Input


1
3 5
30 40 43
55 17 23 22 11
3 0 1 2
3 1 2 3
2 2 1

Sample Output


21

Hint

If Xiao Ming can do less project to earn more money, he will certainly do that.


我很美!

发帖:2008-4-27 12:38:00
 bosong 帅哥哟,离线,有人找我吗?
  
  
  等 级:初出江湖
  积 分:201
  专家分:0
  提问帖:0/0
  回答帖:0
  总帖数:1
  经验值:51
  注 册:2008-4-27
给bosong发送一个短消息 把bosong加入好友 查看bosong的个人资料 搜索bosong在政务大厅的所有贴子  引用回复这个贴子 回复这个贴子303

发贴心情 

很好
发帖:2008-4-27 14:09:00
 czhan 帅哥哟,离线,有人找我吗?天秤座1986-10-18
  
  
  等 级:初出江湖
  积 分:210
  专家分:0
  提问帖:0/0
  回答帖:0
  总帖数:4
  经验值:54
  注 册:2008-4-26
给czhan发送一个短消息 把czhan加入好友 查看czhan的个人资料 搜索czhan在政务大厅的所有贴子 引用回复这个贴子 回复这个贴子304

发贴心情 

不错,呵呵


云卷云舒
花开花落
是看透世事的癫狂
还是涉世未深的懵懂

发帖:2008-4-28 14:41:00
 zcj860928 帅哥哟,离线,有人找我吗?
  
  
  等 级:初出江湖
  积 分:201
  专家分:0
  提问帖:0/0
  回答帖:0
  总帖数:2
  经验值:53
  注 册:2008-4-24
给zcj860928发送一个短消息 把zcj860928加入好友 查看zcj860928的个人资料 搜索zcj860928在政务大厅的所有贴子  引用回复这个贴子 回复这个贴子305

发贴心情 

顶!!!!!
发帖:2008-4-29 20:42:00
 编程庸才生 帅哥哟,离线,有人找我吗?处女座1990-8-28
  
  
  等 级:初出江湖
  积 分:117
  专家分:155
  提问帖:7/5
  回答帖:39
  总帖数:96
  经验值:203
  注 册:2008-4-22
给编程庸才生发送一个短消息 把编程庸才生加入好友 查看编程庸才生的个人资料 搜索编程庸才生在政务大厅的所有贴子 引用回复这个贴子 回复这个贴子306

发贴心情 

......我的分啊.........发帖没了......哭...........-_-

总是在错误浪费时间,谁叫自己编程那么曳!
庸才就是这个样子!

发帖:2008-5-2 14:44:00
 hwp333com 帅哥哟,离线,有人找我吗?
  
  
  等 级:初出江湖
  积 分:24
  专家分:0
  提问帖:3/2
  回答帖:0
  总帖数:10
  经验值:74
  注 册:2008-5-3
给hwp333com发送一个短消息 把hwp333com加入好友 查看hwp333com的个人资料 搜索hwp333com在政务大厅的所有贴子 引用回复这个贴子 回复这个贴子307

发贴心情 

我是新来的,为什么不能发贴?
发帖:2008-5-3 14:42:00
 woshixieba 帅哥哟,离线,有人找我吗?
  
  
  等 级:论坛游民
  积 分:627
  专家分:146
  提问帖:5/5
  回答帖:42
  总帖数:111
  经验值:309
  注 册:2008-4-10
给woshixieba发送一个短消息 把woshixieba加入好友 查看woshixieba的个人资料 搜索woshixieba在政务大厅的所有贴子  引用回复这个贴子 回复这个贴子308

发贴心情 

支持
发帖:2008-5-3 15:42:00
 realchen 帅哥哟,离线,有人找我吗?
  
  
  等 级:初出江湖
  积 分:204
  专家分:0
  提问帖:0/0
  回答帖:0
  总帖数:2
  经验值:52
  注 册:2008-5-4
给realchen发送一个短消息 把realchen加入好友 查看realchen的个人资料 搜索realchen在政务大厅的所有贴子 引用回复这个贴子 回复这个贴子309

发贴心情 

发帖:2008-5-4 19:48:00
 woaini989 帅哥哟,离线,有人找我吗?
  
  
  等 级:初出江湖
  积 分:211
  专家分:3
  提问帖:0/0
  回答帖:1
  总帖数:2
  经验值:54
  注 册:2008-5-4
给woaini989发送一个短消息 把woaini989加入好友 查看woaini989的个人资料 搜索woaini989在政务大厅的所有贴子  引用回复这个贴子 回复这个贴子310

发贴心情 

能不能说的简单一点?  太麻烦了 听不懂  知道是宣传可是怎么个做法?
我都登陆好久了  还是34分钟  我哭 狂哭
发帖:2008-5-5 14:33:00

本主题贴数511,分页:[返回帖子列表] [上一页][1] ... [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] ... [52] [下一页]
 *快速回复:新手积分资助计划 - 宣传网站赢取积分(每点击一次奖20积分)  [ 回帖是一种美德 :) ]
会员账号 用户名    还没注册?    密码    忘记密码?
内容
  • HTML标签: 不可用
  • UBB标签: 可用
  • 贴图标签: 可用
  • 多媒体标签:可用
  • 表情字符转换:可用
  • 上传图片:不可用
  • 最多15KB
  • 点击表情图即可在帖子中加入相应的表情
                                
    邮件回复 显示签名   [Ctrl+Enter直接提交贴子]

    管理选项锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 解除总固顶 | 奖励 | 惩罚 | 发布公告