B - Can you buy them all? Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200200

問題文

高橋商店では NN 個の商品が売られています。i(1iN)i\, (1 \leq i \leq N) 番目の商品の定価は AiA_i 円です。
今日はセールが行われており、偶数番目の商品は定価の 11 円引きの値段で買うことができます。奇数番目の商品は定価で売られています。
あなたの所持金は XX 円です。これら NN 個の商品を全て買うことができますか?

制約

  • 1N1001 \leq N \leq 100
  • 1X100001 \leq X \leq 10000
  • 1Ai1001 \leq A_i \leq 100
  • 入力は全て整数

入力

入力は以下の形式で標準入力から与えられる。

NN XX
A1A_1 A2A_2 \ldots ANA_N

出力

NN 個の商品を全て買うことができるなら Yes、できないなら No と出力せよ。


入力例 1Copy

Copy
2 3
1 3

出力例 1Copy

Copy
Yes

11 番目の商品は 11 円、22 番目の商品は定価より 11 円引きの 22 円で買うことができます。あなたの所持金は 33 円なので、ちょうどの金額で 22 個の商品を全て買うことができます。


入力例 2Copy

Copy
4 10
3 3 4 4

出力例 2Copy

Copy
No

44 個の商品はそれぞれ 33 円、22 円、44 円、33 円で買うことができます。44 個の商品を全て買うためには 1212 円必要ですが、あなたの所持金は 1010 円なので全て買うことはできません。


入力例 3Copy

Copy
8 30
3 1 4 1 5 9 2 6

出力例 3Copy

Copy
Yes

Score : 200200 points

Problem Statement

Takahashi's shop sells NN products. The usual price of the ii-th product is AiA_i yen (Japanese currency).
It has a bargain sale today, with a discount of 11 yen off the usual prices for the 22-nd, 44-th, and the subsequent even-indexed products. The 11-st, 33-rd, and the subsequent odd-indexed products are sold for their usual prices.
You have XX yen. Can you buy all the NN products with this money?

Constraints

  • 1N1001 \leq N \leq 100
  • 1X100001 \leq X \leq 10000
  • 1Ai1001 \leq A_i \leq 100
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN XX
A1A_1 A2A_2 \ldots ANA_N

Output

If you can buy all the NN products, print Yes; otherwise, print No.


Sample Input 1Copy

Copy
2 3
1 3

Sample Output 1Copy

Copy
Yes

You can buy the 11-st product for 11 yen and the 22-nd product for 22 yen, 11 yen off the usual price. You have just enough money, 33 yen, to buy both of them.


Sample Input 2Copy

Copy
4 10
3 3 4 4

Sample Output 2Copy

Copy
No

You can buy these four products for 33 yen, 22 yen, 44 yen, and 33 yen, respectively. You need 1212 yen to buy all of them, and since you have only 1010 yen, you cannot buy all of them.


Sample Input 3Copy

Copy
8 30
3 1 4 1 5 9 2 6

Sample Output 3Copy

Copy
Yes


2025-03-30 (Sun)
11:23:34 +00:00