結果

問題 No.2093 Shio Ramen
ユーザー roarisroaris
提出日時 2022-10-07 21:23:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 86,156 KB
最終ジャッジ日時 2023-09-02 23:44:37
合計ジャッジ時間 4,221 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,016 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 67 ms
71,340 KB
testcase_05 AC 65 ms
71,452 KB
testcase_06 AC 67 ms
71,436 KB
testcase_07 AC 65 ms
71,436 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 84 ms
76,856 KB
testcase_13 AC 82 ms
76,628 KB
testcase_14 AC 83 ms
76,888 KB
testcase_15 WA -
testcase_16 AC 89 ms
76,920 KB
testcase_17 AC 85 ms
76,788 KB
testcase_18 WA -
testcase_19 AC 97 ms
76,708 KB
testcase_20 WA -
testcase_21 AC 95 ms
76,792 KB
testcase_22 AC 93 ms
76,912 KB
testcase_23 WA -
testcase_24 AC 113 ms
85,696 KB
testcase_25 AC 111 ms
85,832 KB
testcase_26 AC 108 ms
85,664 KB
testcase_27 WA -
testcase_28 AC 111 ms
85,656 KB
testcase_29 WA -
testcase_30 AC 111 ms
85,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, I = map(int, input().split())
dp = [[-10**18]*(I+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
    s, a = map(int, input().split())
    
    for j in range(I+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        
        if j+s<=I:
            dp[i+1][j+s] = max(dp[i+1][j+s], dp[i][j]+a)
    
print(dp[-1][I])
0