結果

問題 No.2093 Shio Ramen
ユーザー kept1994kept1994
提出日時 2022-11-03 17:18:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 85,444 KB
最終ジャッジ日時 2023-09-25 01:44:30
合計ジャッジ時間 5,228 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,132 KB
testcase_01 AC 71 ms
71,420 KB
testcase_02 AC 70 ms
71,172 KB
testcase_03 AC 70 ms
71,228 KB
testcase_04 AC 74 ms
71,244 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 71 ms
71,248 KB
testcase_08 AC 71 ms
71,408 KB
testcase_09 AC 93 ms
76,244 KB
testcase_10 AC 119 ms
82,164 KB
testcase_11 AC 84 ms
75,924 KB
testcase_12 AC 94 ms
75,896 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 107 ms
76,112 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 131 ms
84,456 KB
testcase_19 WA -
testcase_20 AC 108 ms
76,208 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 126 ms
84,776 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 128 ms
84,760 KB
testcase_28 AC 128 ms
84,792 KB
testcase_29 AC 128 ms
85,080 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
INF = 10 ** 16
def main():
    N, I = map(int, input().split())
    dp = [[-INF] * (I + 1) for _ in range(N + 1)]
    dp[0][0] = 0
    ramen = []
    for _ in range(N):
        s, a = map(int, input().split())
        ramen.append((s, a))
    for i in range(N):
        for j in range(I):
            s, a = ramen[i]
            if dp[i][j] == -INF:
                continue
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
            if j + s < I + 1:
                dp[i + 1][j + s] = max(dp[i + 1][j + s], dp[i][j] + a)
    print(max(dp[-1]))
if __name__ == '__main__':
    main()
0