結果

問題 No.2093 Shio Ramen
ユーザー Akijin_007
提出日時 2022-10-07 22:47:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 76,508 KB
最終ジャッジ日時 2024-06-12 20:07:10
合計ジャッジ時間 2,722 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

N, I = map(int, input().split())

S = [0] * N
for i in range(N):
    S[i] = list(map(int, input().split()))

dp = [0] * (I+1)

for i in range(N):
    ndp = [0] * (I+1)
    s, a = S[i]
    for j in range(I+1):
        ndp[j] = max(dp[j], ndp[j])
        if j + s <= I:
            ndp[j+s] = max(dp[j] + a, ndp[j+s])
    dp = list(ndp)

# print(dp)
ans = max(dp)
print(dp[I])
0