编程介的小学生 2019-12-30 21:55 采纳率: 20.5%
浏览 75

Assignment Tools 工具问题

Problem Description
In Valentine’s Day, lovers usually send gifts to their GF or BF. To express their sincerity, they choose DIY.

Small JH want to make a surprise to his GF, so he finds a shop named “DIY Space”. But there are so many people scramble for tools to make their gifts. To solve the problem, the boss makes a rule:

1.You will not regain the tool until you can complete all things what you need to do.(If someone has all tools he needs, he will complete immediately. Otherwise, he can’t do anything)

2.If the boss has enough tools he will give you when you need tools.

3.You don't have to queue up.

Small JH should wait until all people leave, because he needs all tools.

People have their tools and never return before completing their tasks. Sometimes it has a state: the boss has no tools any more and everyone can’t get enough tools.

Please tell him whether he should wait.

Input
The input consist of several cases, please deal with till the end of file. Each case contains two integers N and M (0 < N, M <= 100), representing there are N kinds of tools and M people. Second line there are N integers, N(i) means the boss own Ni number of ith tool(equal to the number of tools Small JH need).Then follow M lines, each consisting N integers, the number in ith row and jth column means the amount of the jth tools that the ith people need. After it there also M lines, each line has N integers too, the number in ith row and jth column means this amount of jth tools have been allotted to the ith people.

The total number of ith tool that all people own will not bigger than boss own at first.

Output
Please print “Yes” if Small JH can wait the end, or print “No” if he can’t;

Sample Input
2 2
10 11
9 8
5 8
2 3
3 5

2 2
10 10
9 8
5 8
2 3
3 5

Sample Output
Yes
No

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥15 latex怎么处理论文引理引用参考文献
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?