zoukankan      html  css  js  c++  java
  • HOJ 2634 How to earn more

    How to earn more

    My Tags   (Edit)
      Source : ww
      Time limit : 1 sec   Memory limit : 64 M

    Submitted : 381, Accepted : 217

    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 ithnumber 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 Yi 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.
  • 相关阅读:
    软件工程课后作业3:如何返回一个整数数组中最大子数组的和
    软件工程课后作业2:四则运算题目扩展:可指定题目数量并且支持真分数运算
    软件工程课后作业1:三十道四则运算题目
    团队作业3返回整数数组中最大子数组的和(多个数组)
    求一个二维数组所有子数组和的最大值(郭少周,陈泽)
    郭少周和陈泽两人合作课堂练习和课下作业
    学生成绩查询系统个人NABCD
    返回一个整数组的最大子数组和
    个人项目3
    返回一个二维整数组中最大子数组的和
  • 原文地址:https://www.cnblogs.com/neighthorn/p/6159311.html
Copyright © 2011-2022 走看看