結果

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

ソースコード

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):
        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(ans)
0