B - Nutrients 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 150

問題文

健康に気を使っている高橋君は、M 種類の栄養素について、食事によって十分な量を摂取できているか気になりました。

i 番目の栄養素は 1 日あたり A_i 以上摂取することが目標です。

高橋君は今日 N 品の食品を食べ、i 品目の食品からは栄養素 jX_{i,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

栄養素 11 品目から 202 品目から 0 摂取したため、合わせて 20 摂取しており、10 以上摂取するという目標を達成しています。
栄養素 2,3 についても同様に目標を達成しています。


入力例 2

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

出力例 2

No

栄養素 4 について目標を達成していません。

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.