結果

問題 No.1947 質より種類数
ユーザー pitPpitP
提出日時 2022-05-20 22:36:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 734 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 272,988 KB
最終ジャッジ日時 2023-10-20 13:21:35
合計ジャッジ時間 9,087 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,436 KB
testcase_01 AC 38 ms
53,436 KB
testcase_02 AC 38 ms
53,436 KB
testcase_03 AC 37 ms
53,436 KB
testcase_04 AC 61 ms
68,296 KB
testcase_05 AC 56 ms
66,220 KB
testcase_06 AC 58 ms
66,252 KB
testcase_07 AC 57 ms
66,216 KB
testcase_08 AC 61 ms
68,296 KB
testcase_09 AC 70 ms
70,320 KB
testcase_10 AC 63 ms
68,272 KB
testcase_11 AC 97 ms
85,604 KB
testcase_12 AC 76 ms
72,372 KB
testcase_13 AC 60 ms
68,272 KB
testcase_14 AC 272 ms
127,992 KB
testcase_15 AC 143 ms
103,632 KB
testcase_16 AC 356 ms
150,268 KB
testcase_17 AC 326 ms
172,652 KB
testcase_18 AC 734 ms
262,448 KB
testcase_19 AC 664 ms
238,556 KB
testcase_20 AC 373 ms
195,096 KB
testcase_21 AC 569 ms
217,404 KB
testcase_22 AC 74 ms
74,140 KB
testcase_23 AC 291 ms
127,680 KB
testcase_24 AC 57 ms
66,220 KB
testcase_25 AC 57 ms
66,168 KB
testcase_26 AC 54 ms
64,112 KB
testcase_27 AC 55 ms
64,100 KB
testcase_28 AC 61 ms
68,248 KB
testcase_29 AC 561 ms
272,700 KB
testcase_30 AC 560 ms
272,868 KB
testcase_31 AC 37 ms
53,420 KB
testcase_32 AC 38 ms
53,420 KB
testcase_33 AC 47 ms
61,988 KB
testcase_34 AC 496 ms
272,988 KB
testcase_35 AC 430 ms
272,760 KB
testcase_36 AC 554 ms
272,880 KB
権限があれば一括ダウンロードができます

ソースコード

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 >= 0:
            dp[i+1][j] = max(dp[i][j-vi] + wi + C , dp[i][j] , dp[i+1][j-vi] + wi)
        else:
            dp[i+1][j] = dp[i][j]

print(max(dp[N]))
0