結果

問題 No.5 数字のブロック
ユーザー Ryushi-techRyushi-tech
提出日時 2020-06-26 21:38:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 278 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 76,908 KB
最終ジャッジ日時 2023-09-18 03:30:55
合計ジャッジ時間 9,155 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,068 KB
testcase_01 AC 73 ms
71,212 KB
testcase_02 WA -
testcase_03 AC 516 ms
76,432 KB
testcase_04 AC 91 ms
76,628 KB
testcase_05 WA -
testcase_06 AC 274 ms
76,428 KB
testcase_07 AC 372 ms
76,904 KB
testcase_08 AC 225 ms
76,496 KB
testcase_09 AC 145 ms
76,908 KB
testcase_10 AC 361 ms
76,588 KB
testcase_11 AC 156 ms
76,420 KB
testcase_12 AC 507 ms
76,692 KB
testcase_13 AC 361 ms
76,360 KB
testcase_14 AC 87 ms
75,920 KB
testcase_15 WA -
testcase_16 AC 550 ms
76,464 KB
testcase_17 AC 686 ms
76,776 KB
testcase_18 AC 406 ms
76,684 KB
testcase_19 AC 850 ms
76,708 KB
testcase_20 AC 76 ms
76,028 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 70 ms
71,348 KB
testcase_24 AC 84 ms
76,248 KB
testcase_25 AC 121 ms
76,380 KB
testcase_26 AC 74 ms
75,740 KB
testcase_27 AC 76 ms
76,032 KB
testcase_28 AC 75 ms
75,900 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 74 ms
75,628 KB
testcase_32 AC 73 ms
75,852 KB
testcase_33 AC 70 ms
71,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

l = int(input())
n = int(input())
W = sorted(list(map(int, input().split())))

dp = [-1] * (l+1)
dp[0] = 0

for w in W:
    for i in range(l, -1, -1):
      if i + w > l:
        continue
      elif dp[i] >= 0:
        dp[i + w] = max(dp[i] + 1, dp[i + w])

print(max(dp[:l]))

0