結果

問題 No.1947 質より種類数
ユーザー gr1msl3ygr1msl3y
提出日時 2022-05-22 22:23:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 667 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 77,052 KB
最終ジャッジ日時 2023-10-20 17:21:15
合計ジャッジ時間 6,643 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,540 KB
testcase_01 AC 37 ms
53,540 KB
testcase_02 AC 37 ms
53,540 KB
testcase_03 AC 36 ms
53,540 KB
testcase_04 AC 60 ms
64,276 KB
testcase_05 AC 53 ms
64,284 KB
testcase_06 AC 53 ms
66,368 KB
testcase_07 AC 50 ms
64,284 KB
testcase_08 AC 50 ms
64,288 KB
testcase_09 AC 60 ms
66,328 KB
testcase_10 AC 53 ms
64,280 KB
testcase_11 AC 67 ms
66,600 KB
testcase_12 AC 62 ms
66,332 KB
testcase_13 AC 57 ms
66,332 KB
testcase_14 AC 168 ms
76,384 KB
testcase_15 AC 109 ms
70,788 KB
testcase_16 AC 328 ms
76,604 KB
testcase_17 AC 198 ms
76,616 KB
testcase_18 AC 667 ms
77,052 KB
testcase_19 AC 257 ms
77,020 KB
testcase_20 AC 222 ms
76,748 KB
testcase_21 AC 379 ms
76,732 KB
testcase_22 AC 62 ms
66,540 KB
testcase_23 AC 177 ms
76,408 KB
testcase_24 AC 51 ms
64,276 KB
testcase_25 AC 49 ms
64,212 KB
testcase_26 AC 48 ms
64,208 KB
testcase_27 AC 52 ms
64,208 KB
testcase_28 AC 54 ms
66,292 KB
testcase_29 AC 393 ms
76,816 KB
testcase_30 AC 277 ms
76,968 KB
testcase_31 AC 35 ms
53,540 KB
testcase_32 AC 35 ms
53,540 KB
testcase_33 AC 43 ms
62,132 KB
testcase_34 AC 219 ms
77,052 KB
testcase_35 AC 124 ms
74,656 KB
testcase_36 AC 290 ms
76,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, V, C = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

INF = 10**18
dp = [-INF]*(V+1)
dp[0] = 0

for v, w in A:
    for i in range(V, -1, -1):
        if i+v > V:
            continue
        dp[i+v] = max(dp[i+v], dp[i]+w+C)
    for i in range(V+1):
        if i+v > V:
            break
        dp[i+v] = max(dp[i+v], dp[i]+w)

print(max(dp))
0