結果

問題 No.1947 質より種類数
ユーザー chineristACchineristAC
提出日時 2022-05-20 21:42:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 543 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,724 KB
実行使用メモリ 77,976 KB
最終ジャッジ日時 2023-10-20 12:08:46
合計ジャッジ時間 7,370 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
56,040 KB
testcase_01 AC 48 ms
56,040 KB
testcase_02 AC 51 ms
56,040 KB
testcase_03 AC 48 ms
56,040 KB
testcase_04 AC 81 ms
70,848 KB
testcase_05 AC 71 ms
70,852 KB
testcase_06 AC 75 ms
70,900 KB
testcase_07 AC 72 ms
70,848 KB
testcase_08 AC 71 ms
70,856 KB
testcase_09 AC 79 ms
73,220 KB
testcase_10 AC 78 ms
72,896 KB
testcase_11 AC 99 ms
77,212 KB
testcase_12 AC 92 ms
76,592 KB
testcase_13 AC 74 ms
72,900 KB
testcase_14 AC 218 ms
77,312 KB
testcase_15 AC 123 ms
77,256 KB
testcase_16 AC 284 ms
77,372 KB
testcase_17 AC 230 ms
77,472 KB
testcase_18 AC 543 ms
77,680 KB
testcase_19 AC 461 ms
77,616 KB
testcase_20 AC 254 ms
77,548 KB
testcase_21 AC 468 ms
77,616 KB
testcase_22 AC 92 ms
77,192 KB
testcase_23 AC 221 ms
77,288 KB
testcase_24 AC 70 ms
70,848 KB
testcase_25 AC 69 ms
70,784 KB
testcase_26 AC 66 ms
68,732 KB
testcase_27 AC 68 ms
68,732 KB
testcase_28 AC 73 ms
70,820 KB
testcase_29 AC 398 ms
77,956 KB
testcase_30 AC 322 ms
77,932 KB
testcase_31 AC 48 ms
56,044 KB
testcase_32 AC 50 ms
56,044 KB
testcase_33 AC 59 ms
64,592 KB
testcase_34 AC 361 ms
77,728 KB
testcase_35 AC 183 ms
77,648 KB
testcase_36 AC 327 ms
77,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
import heapq
from itertools import permutations
from math import gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

INF = 10**17

N,V,C = mi()
dp = [-INF] * (V+1)
dp[0] = 0

for _ in range(N):
    v,w = mi()
    ndp = [-INF] * (V+1)
    for i in range(V+1-v):
        ndp[i+v] = dp[i]+C+w
    for i in range(V+1):
        ndp[i] = max(dp[i],ndp[i])
        if v <= i:
            ndp[i] = max(ndp[i],ndp[i-v]+w)
    dp = ndp

print(max(dp))
    
0