結果

問題 No.5 数字のブロック
ユーザー deepjugglingdeepjuggling
提出日時 2023-03-15 15:03:30
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 406 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 81,656 KB
実行使用メモリ 845,428 KB
最終ジャッジ日時 2023-10-18 12:24:19
合計ジャッジ時間 21,776 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,312 KB
testcase_01 AC 41 ms
58,744 KB
testcase_02 AC 37 ms
53,312 KB
testcase_03 AC 1,702 ms
440,136 KB
testcase_04 AC 148 ms
80,472 KB
testcase_05 MLE -
testcase_06 AC 790 ms
225,596 KB
testcase_07 AC 1,144 ms
316,124 KB
testcase_08 AC 668 ms
218,760 KB
testcase_09 AC 273 ms
128,464 KB
testcase_10 AC 1,025 ms
303,460 KB
testcase_11 AC 327 ms
133,932 KB
testcase_12 AC 1,664 ms
437,116 KB
testcase_13 AC 1,042 ms
305,320 KB
testcase_14 AC 82 ms
72,016 KB
testcase_15 AC 57 ms
64,060 KB
testcase_16 AC 1,802 ms
465,992 KB
testcase_17 MLE -
testcase_18 AC 1,705 ms
405,152 KB
testcase_19 MLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

l = int(input())
n = int(input())
dp = [[-1 for i in range(l+1)] for j in range(n+1)]

a = list(map(int,input().split()))
dp[0][0] = 0
for i in range(n):
    for j in range(l+1):
        dp[i+1][j] = dp[i][j]
    for j in range(l+1):
        if j+a[i] <= l:
            if dp[i][j] >= 0:
                dp[i+1][j+a[i]] = max(dp[i+1][j+a[i]],dp[i][j]+1)
ma = 0
for i in dp[-1]:
    ma = max(ma,i)
print(ma)
0