結果

問題 No.1947 質より種類数
ユーザー 👑 KazunKazun
提出日時 2022-05-20 21:41:00
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 817 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 81,704 KB
実行使用メモリ 78,092 KB
最終ジャッジ日時 2023-10-20 12:07:18
合計ジャッジ時間 10,201 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,464 KB
testcase_01 AC 37 ms
53,464 KB
testcase_02 AC 36 ms
53,464 KB
testcase_03 AC 37 ms
53,464 KB
testcase_04 AC 80 ms
73,052 KB
testcase_05 AC 65 ms
70,428 KB
testcase_06 AC 74 ms
73,064 KB
testcase_07 AC 66 ms
70,444 KB
testcase_08 AC 70 ms
72,504 KB
testcase_09 AC 96 ms
75,644 KB
testcase_10 AC 94 ms
75,584 KB
testcase_11 AC 131 ms
76,460 KB
testcase_12 AC 103 ms
75,600 KB
testcase_13 AC 82 ms
75,604 KB
testcase_14 AC 230 ms
76,656 KB
testcase_15 AC 182 ms
76,476 KB
testcase_16 AC 374 ms
77,012 KB
testcase_17 AC 531 ms
77,300 KB
testcase_18 AC 728 ms
78,092 KB
testcase_19 AC 817 ms
77,884 KB
testcase_20 AC 397 ms
77,428 KB
testcase_21 AC 476 ms
77,600 KB
testcase_22 AC 103 ms
75,600 KB
testcase_23 AC 309 ms
76,912 KB
testcase_24 AC 70 ms
72,528 KB
testcase_25 AC 67 ms
70,460 KB
testcase_26 AC 63 ms
68,408 KB
testcase_27 AC 66 ms
70,460 KB
testcase_28 AC 68 ms
70,480 KB
testcase_29 AC 374 ms
77,884 KB
testcase_30 AC 357 ms
77,892 KB
testcase_31 AC 37 ms
53,468 KB
testcase_32 AC 37 ms
53,468 KB
testcase_33 AC 46 ms
60,088 KB
testcase_34 AC 359 ms
77,980 KB
testcase_35 AC 233 ms
77,864 KB
testcase_36 AC 342 ms
77,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,V,C=map(int,input().split())

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

for i in range(N):
    v,w=map(int,input().split())

    E=DP
    DP=[-inf]*(V+1)

    for j in range(V+1):
        if j<v:
            DP[j]=E[j]
        else:
            DP[j]=max(E[j],DP[j-v]+w,E[j-v]+w+C)

print(max(DP))
0