結果

問題 No.1947 質より種類数
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-20 23:45:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 492 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 76,460 KB
最終ジャッジ日時 2023-10-20 14:41:52
合計ジャッジ時間 6,673 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,560 KB
testcase_01 AC 37 ms
53,560 KB
testcase_02 AC 37 ms
53,560 KB
testcase_03 AC 37 ms
53,560 KB
testcase_04 AC 52 ms
64,260 KB
testcase_05 AC 56 ms
64,260 KB
testcase_06 AC 55 ms
66,340 KB
testcase_07 AC 52 ms
64,260 KB
testcase_08 AC 53 ms
64,260 KB
testcase_09 AC 63 ms
68,356 KB
testcase_10 AC 59 ms
66,308 KB
testcase_11 AC 77 ms
75,932 KB
testcase_12 AC 69 ms
72,452 KB
testcase_13 AC 57 ms
66,308 KB
testcase_14 AC 192 ms
75,972 KB
testcase_15 AC 111 ms
75,972 KB
testcase_16 AC 253 ms
76,092 KB
testcase_17 AC 247 ms
76,172 KB
testcase_18 AC 492 ms
76,400 KB
testcase_19 AC 448 ms
76,324 KB
testcase_20 AC 202 ms
76,176 KB
testcase_21 AC 402 ms
76,248 KB
testcase_22 AC 69 ms
72,880 KB
testcase_23 AC 175 ms
76,000 KB
testcase_24 AC 53 ms
64,252 KB
testcase_25 AC 53 ms
64,192 KB
testcase_26 AC 51 ms
64,192 KB
testcase_27 AC 53 ms
64,192 KB
testcase_28 AC 56 ms
66,268 KB
testcase_29 AC 350 ms
76,432 KB
testcase_30 AC 302 ms
76,452 KB
testcase_31 AC 39 ms
53,560 KB
testcase_32 AC 37 ms
53,560 KB
testcase_33 AC 47 ms
62,108 KB
testcase_34 AC 310 ms
76,436 KB
testcase_35 AC 139 ms
76,300 KB
testcase_36 AC 298 ms
76,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 10

N, V, C = map(int, input().split())
dp = [-inf] * (V + 1)
dp[0] = 0
for _ in range(N):
    v, w = map(int, input().split())
    ndp = [-inf] * (V + 1)
    for i in range(v, V + 1):
        ndp[i] = max(dp[i-v] + w, ndp[i-v] + w)
    for i in range(V+1):
        dp[i] = max(dp[i], ndp[i] + C)

print(max(dp))
0