結果

問題 No.2093 Shio Ramen
ユーザー Akijin_007Akijin_007
提出日時 2022-10-07 22:47:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 77,660 KB
最終ジャッジ日時 2023-09-03 14:25:32
合計ジャッジ時間 5,508 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,468 KB
testcase_01 AC 74 ms
71,360 KB
testcase_02 AC 73 ms
71,400 KB
testcase_03 AC 74 ms
71,436 KB
testcase_04 AC 74 ms
71,568 KB
testcase_05 AC 72 ms
71,332 KB
testcase_06 AC 72 ms
71,200 KB
testcase_07 AC 73 ms
71,292 KB
testcase_08 AC 72 ms
71,376 KB
testcase_09 AC 91 ms
76,532 KB
testcase_10 AC 104 ms
77,244 KB
testcase_11 AC 83 ms
76,040 KB
testcase_12 AC 94 ms
76,532 KB
testcase_13 AC 95 ms
76,924 KB
testcase_14 AC 96 ms
76,808 KB
testcase_15 AC 105 ms
77,480 KB
testcase_16 AC 91 ms
76,544 KB
testcase_17 AC 100 ms
76,836 KB
testcase_18 AC 111 ms
77,608 KB
testcase_19 AC 111 ms
77,380 KB
testcase_20 AC 106 ms
77,560 KB
testcase_21 AC 106 ms
77,512 KB
testcase_22 AC 106 ms
77,440 KB
testcase_23 AC 112 ms
77,644 KB
testcase_24 AC 113 ms
77,400 KB
testcase_25 AC 112 ms
77,548 KB
testcase_26 AC 113 ms
77,432 KB
testcase_27 AC 111 ms
77,604 KB
testcase_28 AC 113 ms
77,524 KB
testcase_29 AC 113 ms
77,508 KB
testcase_30 AC 113 ms
77,660 KB
権限があれば一括ダウンロードができます

ソースコード

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