結果

問題 No.2093 Shio Ramen
ユーザー tnogamitnogami
提出日時 2022-10-08 14:17:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 956 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 17,180 KB
最終ジャッジ日時 2023-09-04 19:16:24
合計ジャッジ時間 14,377 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 16 ms
7,824 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 16 ms
7,888 KB
testcase_05 AC 15 ms
7,828 KB
testcase_06 AC 16 ms
7,936 KB
testcase_07 AC 16 ms
7,752 KB
testcase_08 AC 16 ms
7,772 KB
testcase_09 AC 126 ms
9,496 KB
testcase_10 AC 639 ms
14,516 KB
testcase_11 AC 49 ms
8,560 KB
testcase_12 AC 88 ms
8,792 KB
testcase_13 AC 46 ms
8,532 KB
testcase_14 AC 86 ms
8,788 KB
testcase_15 AC 486 ms
12,912 KB
testcase_16 AC 183 ms
10,076 KB
testcase_17 AC 120 ms
9,332 KB
testcase_18 AC 922 ms
17,180 KB
testcase_19 AC 583 ms
13,808 KB
testcase_20 AC 338 ms
11,392 KB
testcase_21 AC 455 ms
12,252 KB
testcase_22 AC 427 ms
12,280 KB
testcase_23 AC 943 ms
16,644 KB
testcase_24 AC 937 ms
16,752 KB
testcase_25 AC 934 ms
16,812 KB
testcase_26 AC 956 ms
16,836 KB
testcase_27 AC 945 ms
16,632 KB
testcase_28 AC 947 ms
16,704 KB
testcase_29 AC 941 ms
16,740 KB
testcase_30 AC 927 ms
16,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, I = map(int, input().split())
ramens = [tuple(map(int, input().split())) for _ in range(N)]

dp = [[0]*(I+1) for _ in range(N+1)]

for n in range(N):
    sio, aji = ramens[n]
    for i in range(I+1):
        dp[n+1][i] = max(dp[n+1][i], dp[n][i])
        if I < i + sio: continue
        dp[n+1][i+sio] = max(dp[n+1][i+sio], dp[n][i]+aji)

print(max(dp[N]))
0