結果

問題 No.1947 質より種類数
ユーザー pitPpitP
提出日時 2022-05-20 22:32:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 78,816 KB
最終ジャッジ日時 2023-10-20 13:17:16
合計ジャッジ時間 8,519 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
14,556 KB
testcase_01 AC 28 ms
10,040 KB
testcase_02 AC 28 ms
10,040 KB
testcase_03 AC 29 ms
10,040 KB
testcase_04 AC 167 ms
13,236 KB
testcase_05 WA -
testcase_06 AC 128 ms
12,540 KB
testcase_07 AC 145 ms
11,880 KB
testcase_08 AC 166 ms
12,816 KB
testcase_09 AC 603 ms
23,880 KB
testcase_10 AC 435 ms
20,324 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 359 ms
16,408 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[0] * (V+1) for _ in range(N+1)]

for i in range(N):
    vi,wi = g[i]
    for j in range(V+1):
        if j+vi <= V:
            dp[i+1][j+vi] = max(dp[i][j] + wi + C , dp[i][j+vi] , dp[i+1][j] + wi)

print(max(dp[N]))
0