結果

問題 No.2093 Shio Ramen
ユーザー rlangevin
提出日時 2023-01-13 00:23:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 74,652 KB
最終ジャッジ日時 2024-12-23 16:31:35
合計ジャッジ時間 4,465 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 17 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

N, I = map(int, input().split())
inf = 10 ** 18
pre = [-inf] * (I + 1)
pre[0] = 0
for i in range(N):
    s, a = map(int, input().split())
    dp = [-inf] * (I + 1)
    for j in range(I):
        dp[j] = max(dp[j], pre[j])
        if j + s > I:
            continue
        dp[j + s] = max(dp[j + s], pre[j] + a)
    dp, pre =  pre, dp
print(max(pre))    
0