結果

問題 No.2232 Miser's Gift
ユーザー chankei271828chankei271828
提出日時 2023-03-03 23:28:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 296 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 156,096 KB
最終ジャッジ日時 2023-10-18 03:42:15
合計ジャッジ時間 15,650 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
62,712 KB
testcase_01 AC 52 ms
64,792 KB
testcase_02 AC 50 ms
63,496 KB
testcase_03 AC 237 ms
156,096 KB
testcase_04 AC 231 ms
156,096 KB
testcase_05 AC 208 ms
147,636 KB
testcase_06 AC 44 ms
60,988 KB
testcase_07 AC 72 ms
78,472 KB
testcase_08 AC 244 ms
156,096 KB
testcase_09 AC 246 ms
156,096 KB
testcase_10 AC 244 ms
156,096 KB
testcase_11 AC 282 ms
156,096 KB
testcase_12 AC 249 ms
156,096 KB
testcase_13 AC 228 ms
156,096 KB
testcase_14 AC 233 ms
156,096 KB
testcase_15 AC 229 ms
156,096 KB
testcase_16 AC 228 ms
156,096 KB
testcase_17 AC 228 ms
156,096 KB
testcase_18 AC 228 ms
156,096 KB
testcase_19 AC 234 ms
156,096 KB
testcase_20 AC 226 ms
156,096 KB
testcase_21 AC 229 ms
156,096 KB
testcase_22 AC 233 ms
156,096 KB
testcase_23 AC 296 ms
156,096 KB
testcase_24 AC 295 ms
156,096 KB
testcase_25 AC 296 ms
156,096 KB
testcase_26 AC 292 ms
156,096 KB
testcase_27 AC 294 ms
156,096 KB
testcase_28 AC 243 ms
156,096 KB
testcase_29 AC 243 ms
156,096 KB
testcase_30 AC 242 ms
156,096 KB
testcase_31 AC 271 ms
156,096 KB
testcase_32 AC 270 ms
156,096 KB
testcase_33 AC 231 ms
156,096 KB
testcase_34 AC 232 ms
156,096 KB
testcase_35 AC 231 ms
156,096 KB
testcase_36 AC 231 ms
156,096 KB
testcase_37 AC 230 ms
156,096 KB
testcase_38 AC 207 ms
143,164 KB
testcase_39 AC 207 ms
145,152 KB
testcase_40 AC 208 ms
145,152 KB
testcase_41 AC 206 ms
143,104 KB
testcase_42 AC 207 ms
145,152 KB
testcase_43 AC 207 ms
143,104 KB
testcase_44 AC 208 ms
145,152 KB
testcase_45 AC 208 ms
145,152 KB
testcase_46 AC 207 ms
145,152 KB
testcase_47 AC 207 ms
145,152 KB
testcase_48 AC 200 ms
142,904 KB
testcase_49 AC 200 ms
142,904 KB
testcase_50 AC 201 ms
142,904 KB
testcase_51 AC 200 ms
142,904 KB
testcase_52 AC 203 ms
142,904 KB
testcase_53 AC 201 ms
142,904 KB
testcase_54 AC 200 ms
142,904 KB
testcase_55 AC 202 ms
142,904 KB
testcase_56 AC 200 ms
142,904 KB
testcase_57 AC 201 ms
142,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,W=map(int,input().split())
pre=[tuple(map(int,input().split())) for _ in range(N)]
dp=[[0]*(10**5+1) for _ in range(N+1)]
#dp[i][j]:i番目の品物までで、重さjになる組み合わせの中での勝ちの総和の最大値
for i in range(1,N+1):
    w,v=pre[i-1]
    for j in range(1,10**5+1):
        if j-w>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v)
        else:
            dp[i][j]=dp[i-1][j]
for j in range(1,W+1):
    dp[-1][j]=max(dp[-1][j],dp[-1][j-1])
for X in range(1,W+1):
    print(dp[-1][W]-dp[-1][W-X]+1)
0