結果

問題 No.2093 Shio Ramen
ユーザー rlangevinrlangevin
提出日時 2023-01-13 00:23:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 990 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 77,416 KB
最終ジャッジ日時 2023-08-25 04:19:49
合計ジャッジ時間 6,077 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,232 KB
testcase_01 AC 74 ms
71,224 KB
testcase_02 AC 75 ms
71,072 KB
testcase_03 AC 74 ms
71,076 KB
testcase_04 AC 76 ms
71,368 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 76 ms
71,336 KB
testcase_08 AC 76 ms
71,092 KB
testcase_09 AC 106 ms
76,632 KB
testcase_10 AC 107 ms
76,964 KB
testcase_11 AC 90 ms
75,832 KB
testcase_12 AC 98 ms
77,100 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 103 ms
76,780 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 113 ms
77,168 KB
testcase_19 WA -
testcase_20 AC 100 ms
76,720 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 109 ms
77,268 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 110 ms
77,148 KB
testcase_28 AC 110 ms
77,412 KB
testcase_29 AC 115 ms
77,200 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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