結果

問題 No.2093 Shio Ramen
ユーザー lloyzlloyz
提出日時 2022-10-07 21:59:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 85,736 KB
最終ジャッジ日時 2023-09-03 05:03:49
合計ジャッジ時間 5,141 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,604 KB
testcase_01 AC 71 ms
71,288 KB
testcase_02 AC 76 ms
71,428 KB
testcase_03 AC 70 ms
71,120 KB
testcase_04 AC 72 ms
71,168 KB
testcase_05 AC 70 ms
71,268 KB
testcase_06 AC 69 ms
71,420 KB
testcase_07 AC 70 ms
71,508 KB
testcase_08 AC 70 ms
71,436 KB
testcase_09 AC 97 ms
77,068 KB
testcase_10 AC 115 ms
83,120 KB
testcase_11 AC 86 ms
76,112 KB
testcase_12 AC 98 ms
77,000 KB
testcase_13 AC 96 ms
77,028 KB
testcase_14 AC 100 ms
77,000 KB
testcase_15 AC 109 ms
81,356 KB
testcase_16 AC 95 ms
77,084 KB
testcase_17 AC 97 ms
76,920 KB
testcase_18 AC 122 ms
85,028 KB
testcase_19 AC 121 ms
82,872 KB
testcase_20 AC 110 ms
80,336 KB
testcase_21 AC 111 ms
81,660 KB
testcase_22 AC 108 ms
81,692 KB
testcase_23 AC 121 ms
85,572 KB
testcase_24 AC 123 ms
85,500 KB
testcase_25 AC 124 ms
85,516 KB
testcase_26 AC 123 ms
85,736 KB
testcase_27 AC 122 ms
85,364 KB
testcase_28 AC 124 ms
85,512 KB
testcase_29 AC 121 ms
85,528 KB
testcase_30 AC 123 ms
85,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, i = map(int, input().split())
DP = [[-1 for _ in range(i + 1)] for _ in range(n + 1)]
DP[0][0] = 0
for j in range(n):
    s, a = map(int, input().split())
    for x in range(i + 1):
        if DP[j][x] != -1:
            DP[j + 1][x] = max(DP[j + 1][x], DP[j][x])
            if x + s <= i:
                DP[j + 1][x + s] = max(DP[j + 1][x + s], DP[j][x] + a)
print(max(DP[n]))
0