103561: [Atcoder]ABC356 B - Nutrients

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:8 Solved:0

Description

Score : $150$ points

Problem Statement

Takahashi is health-conscious and concerned about whether he is getting enough of $M$ types of nutrients from his diet.

For the $i$-th nutrient, his goal is to take at least $A_i$ units per day.

Today, he ate $N$ foods, and from the $i$-th food, he took $X_{i,j}$ units of nutrient $j$.

Determine whether he has met the goal for all $M$ types of nutrients.

Constraints

  • $1 \leq N \leq 100$
  • $1 \leq M \leq 100$
  • $0 \leq A_i, X_{i,j} \leq 10^7$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

$N$ $M$
$A_1$ $\ldots$ $A_M$
$X_{1,1}$ $\ldots$ $X_{1,M}$
$\vdots$
$X_{N,1}$ $\ldots$ $X_{N,M}$

Output

Print Yes if the goal is met for all $M$ types of nutrients, and No otherwise.


Sample Input 1

2 3
10 20 30
20 0 10
0 100 100

Sample Output 1

Yes

For nutrient $1$, Takahashi took $20$ units from the $1$-st food and $0$ units from the $2$-nd food, totaling $20$ units, thus meeting the goal of taking at least $10$ units.
Similarly, he meets the goal for nutrients $2$ and $3$.


Sample Input 2

2 4
10 20 30 40
20 0 10 30
0 100 100 0

Sample Output 2

No

The goal is not met for nutrient $4$.

Output

得分:150分 ---

问题描述

高桥很注重健康,关注他是否从饮食中摄取了足够的$M$种营养素。

对于第$i$种营养素,他的目标是每天至少摄取$A_i$单位。

今天,他吃了$N$种食物,从第$i$种食物中,他摄取了$X_{i,j}$单位的第$j$种营养素。

判断他是否达到了所有$M$种营养素的目标。

限制条件

  • $1 \leq N \leq 100$
  • $1 \leq M \leq 100$
  • $0 \leq A_i, X_{i,j} \leq 10^7$
  • 所有输入值为整数。

输入

输入从标准输入以以下格式给出:

$N$ $M$
$A_1$ $\ldots$ $A_M$
$X_{1,1}$ $\ldots$ $X_{1,M}$
$\vdots$
$X_{N,1}$ $\ldots$ $X_{N,M}$

输出

如果所有$M$种营养素都达到了目标,打印Yes,否则打印No


样例输入1

2 3
10 20 30
20 0 10
0 100 100

样例输出1

Yes

对于营养素$1$,高桥从第$1$种食物中摄取了$20$单位,从第$2$种食物中摄取了$0$单位,总共$20$单位,达到了至少$10$单位的目标。
同样,他也达到了营养素$2$和$3$的目标。


样例输入2

2 4
10 20 30 40
20 0 10 30
0 100 100 0

样例输出2

No

营养素$4$的目标没有达成。

加入题单

算法标签: