結果

問題 No.1947 質より種類数
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-21 16:33:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 71,116 KB
最終ジャッジ日時 2023-10-20 16:21:31
合計ジャッジ時間 5,108 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,492 KB
testcase_01 AC 32 ms
53,492 KB
testcase_02 AC 33 ms
53,492 KB
testcase_03 AC 33 ms
53,492 KB
testcase_04 AC 60 ms
64,224 KB
testcase_05 AC 47 ms
64,232 KB
testcase_06 AC 52 ms
66,316 KB
testcase_07 AC 47 ms
64,232 KB
testcase_08 AC 46 ms
64,232 KB
testcase_09 AC 54 ms
64,232 KB
testcase_10 AC 54 ms
64,232 KB
testcase_11 AC 66 ms
69,064 KB
testcase_12 AC 67 ms
64,232 KB
testcase_13 AC 52 ms
64,232 KB
testcase_14 AC 133 ms
69,064 KB
testcase_15 AC 87 ms
69,064 KB
testcase_16 AC 198 ms
71,116 KB
testcase_17 AC 126 ms
71,112 KB
testcase_18 AC 403 ms
71,112 KB
testcase_19 AC 163 ms
71,112 KB
testcase_20 AC 164 ms
71,116 KB
testcase_21 AC 316 ms
71,116 KB
testcase_22 AC 63 ms
69,056 KB
testcase_23 AC 130 ms
69,064 KB
testcase_24 AC 46 ms
64,232 KB
testcase_25 AC 47 ms
64,160 KB
testcase_26 AC 44 ms
64,160 KB
testcase_27 AC 46 ms
64,160 KB
testcase_28 AC 48 ms
64,200 KB
testcase_29 AC 293 ms
71,100 KB
testcase_30 AC 233 ms
71,100 KB
testcase_31 AC 32 ms
53,492 KB
testcase_32 AC 37 ms
53,492 KB
testcase_33 AC 45 ms
62,084 KB
testcase_34 AC 56 ms
71,080 KB
testcase_35 AC 56 ms
71,016 KB
testcase_36 AC 267 ms
71,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, v, c = map(int, input().split())
dp = [-10 ** 9] * (v + 1)
dp[0] = 0
for _ in range(n):
    a, b = map(int, input().split())
    for i in range(a, v + 1)[::-1]:
        dp[i] = max(dp[i], dp[i-a] + b + c)
    for i in range(a, v + 1):
        dp[i] = max(dp[i], dp[i-a] + b)
print(max(dp))
0