結果

問題 No.2093 Shio Ramen
ユーザー roarisroaris
提出日時 2022-10-07 21:25:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 86,800 KB
実行使用メモリ 85,792 KB
最終ジャッジ日時 2023-09-02 23:49:46
合計ジャッジ時間 4,785 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,392 KB
testcase_01 AC 68 ms
71,420 KB
testcase_02 AC 65 ms
71,132 KB
testcase_03 AC 66 ms
71,484 KB
testcase_04 AC 66 ms
71,172 KB
testcase_05 AC 67 ms
71,488 KB
testcase_06 AC 67 ms
71,280 KB
testcase_07 AC 66 ms
71,212 KB
testcase_08 AC 64 ms
71,336 KB
testcase_09 AC 88 ms
77,160 KB
testcase_10 AC 100 ms
77,044 KB
testcase_11 AC 78 ms
75,996 KB
testcase_12 AC 89 ms
76,900 KB
testcase_13 AC 84 ms
76,944 KB
testcase_14 AC 83 ms
77,016 KB
testcase_15 AC 92 ms
76,996 KB
testcase_16 AC 89 ms
76,944 KB
testcase_17 AC 86 ms
76,916 KB
testcase_18 AC 111 ms
85,404 KB
testcase_19 AC 95 ms
76,768 KB
testcase_20 AC 90 ms
77,028 KB
testcase_21 AC 91 ms
76,764 KB
testcase_22 AC 90 ms
76,940 KB
testcase_23 AC 106 ms
85,560 KB
testcase_24 AC 108 ms
85,712 KB
testcase_25 AC 111 ms
85,752 KB
testcase_26 AC 111 ms
85,692 KB
testcase_27 AC 109 ms
85,604 KB
testcase_28 AC 116 ms
85,792 KB
testcase_29 AC 112 ms
85,784 KB
testcase_30 AC 113 ms
85,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, I = map(int, input().split())
dp = [[-10**18]*(I+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
    s, a = map(int, input().split())
    
    for j in range(I+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        
        if j+s<=I:
            dp[i+1][j+s] = max(dp[i+1][j+s], dp[i][j]+a)
    
print(max(dp[-1]))
0