結果

問題 No.2093 Shio Ramen
ユーザー Akijin_007Akijin_007
提出日時 2022-10-07 22:20:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 78,324 KB
最終ジャッジ日時 2023-09-03 13:16:48
合計ジャッジ時間 5,073 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,456 KB
testcase_01 AC 72 ms
71,444 KB
testcase_02 AC 71 ms
71,412 KB
testcase_03 AC 73 ms
71,528 KB
testcase_04 AC 76 ms
71,460 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 73 ms
71,304 KB
testcase_08 AC 73 ms
71,076 KB
testcase_09 AC 101 ms
77,332 KB
testcase_10 AC 124 ms
77,844 KB
testcase_11 AC 92 ms
76,620 KB
testcase_12 AC 105 ms
77,512 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 118 ms
77,848 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 131 ms
77,936 KB
testcase_19 WA -
testcase_20 AC 120 ms
77,872 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 129 ms
77,832 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 131 ms
78,152 KB
testcase_28 AC 133 ms
77,892 KB
testcase_29 AC 136 ms
77,844 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = [-float("INF")] * (I+1)
dp[0] = 0

for i in range(N):
    ndp = [-float("INF")] * (I+1)
    ndp[0] = 0
    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