結果

問題 No.1947 質より種類数
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-05-20 22:54:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 561 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 73,480 KB
最終ジャッジ日時 2023-10-20 13:44:58
合計ジャッジ時間 7,220 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,424 KB
testcase_01 AC 39 ms
53,424 KB
testcase_02 AC 38 ms
53,424 KB
testcase_03 AC 40 ms
53,424 KB
testcase_04 AC 68 ms
68,396 KB
testcase_05 AC 63 ms
68,368 KB
testcase_06 AC 68 ms
70,460 KB
testcase_07 AC 65 ms
68,368 KB
testcase_08 AC 66 ms
68,380 KB
testcase_09 AC 75 ms
68,368 KB
testcase_10 AC 74 ms
70,444 KB
testcase_11 AC 107 ms
73,480 KB
testcase_12 AC 85 ms
70,432 KB
testcase_13 AC 71 ms
70,444 KB
testcase_14 AC 223 ms
72,928 KB
testcase_15 AC 125 ms
72,928 KB
testcase_16 AC 315 ms
72,928 KB
testcase_17 AC 312 ms
72,928 KB
testcase_18 AC 561 ms
72,912 KB
testcase_19 AC 502 ms
72,920 KB
testcase_20 AC 391 ms
73,456 KB
testcase_21 AC 465 ms
72,920 KB
testcase_22 AC 87 ms
70,840 KB
testcase_23 AC 243 ms
72,924 KB
testcase_24 AC 68 ms
68,380 KB
testcase_25 AC 65 ms
68,368 KB
testcase_26 AC 61 ms
66,312 KB
testcase_27 AC 64 ms
68,376 KB
testcase_28 AC 69 ms
70,980 KB
testcase_29 AC 502 ms
66,684 KB
testcase_30 AC 317 ms
66,696 KB
testcase_31 AC 39 ms
53,424 KB
testcase_32 AC 39 ms
53,424 KB
testcase_33 AC 49 ms
62,152 KB
testcase_34 AC 62 ms
68,752 KB
testcase_35 AC 49 ms
64,408 KB
testcase_36 AC 313 ms
66,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

N,V,C = map(int,stdin.readline().split())

dp = [float("-inf")] * (V+1)
dp[0] = 0

for i in range(N):

    v,w = map(int,stdin.readline().split())
    for i in range(V-v,-1,-1):

        dp[i+v] = max(dp[i+v] , dp[i] + C + w)

    for i in range(V-v+1):
        dp[i+v] = max(dp[i+v] , dp[i] + w)

print (max(dp))
        
0