結果

問題 No.2232 Miser's Gift
ユーザー hir355hir355
提出日時 2023-03-03 21:30:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 406 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 1,262 ms
コンパイル使用メモリ 81,448 KB
実行使用メモリ 155,944 KB
最終ジャッジ日時 2023-10-18 01:24:39
合計ジャッジ時間 15,370 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,228 KB
testcase_01 AC 39 ms
53,228 KB
testcase_02 AC 39 ms
53,228 KB
testcase_03 AC 294 ms
155,944 KB
testcase_04 AC 291 ms
155,944 KB
testcase_05 AC 76 ms
73,036 KB
testcase_06 AC 39 ms
53,228 KB
testcase_07 AC 71 ms
78,320 KB
testcase_08 AC 320 ms
155,944 KB
testcase_09 AC 322 ms
155,944 KB
testcase_10 AC 316 ms
155,944 KB
testcase_11 AC 317 ms
155,944 KB
testcase_12 AC 321 ms
155,944 KB
testcase_13 AC 300 ms
155,944 KB
testcase_14 AC 294 ms
155,944 KB
testcase_15 AC 295 ms
155,944 KB
testcase_16 AC 297 ms
155,944 KB
testcase_17 AC 296 ms
155,944 KB
testcase_18 AC 297 ms
155,944 KB
testcase_19 AC 296 ms
155,944 KB
testcase_20 AC 296 ms
155,944 KB
testcase_21 AC 296 ms
155,944 KB
testcase_22 AC 297 ms
155,944 KB
testcase_23 AC 398 ms
155,944 KB
testcase_24 AC 396 ms
155,944 KB
testcase_25 AC 406 ms
155,944 KB
testcase_26 AC 360 ms
155,944 KB
testcase_27 AC 399 ms
155,944 KB
testcase_28 AC 332 ms
155,944 KB
testcase_29 AC 319 ms
155,944 KB
testcase_30 AC 335 ms
155,944 KB
testcase_31 AC 321 ms
155,944 KB
testcase_32 AC 318 ms
155,944 KB
testcase_33 AC 298 ms
155,944 KB
testcase_34 AC 298 ms
155,944 KB
testcase_35 AC 298 ms
155,944 KB
testcase_36 AC 295 ms
155,944 KB
testcase_37 AC 297 ms
155,944 KB
testcase_38 AC 61 ms
65,828 KB
testcase_39 AC 61 ms
65,828 KB
testcase_40 AC 60 ms
65,828 KB
testcase_41 AC 62 ms
65,828 KB
testcase_42 AC 59 ms
65,812 KB
testcase_43 AC 61 ms
65,828 KB
testcase_44 AC 59 ms
65,836 KB
testcase_45 AC 57 ms
65,812 KB
testcase_46 AC 58 ms
65,812 KB
testcase_47 AC 58 ms
65,812 KB
testcase_48 AC 51 ms
63,576 KB
testcase_49 AC 51 ms
63,576 KB
testcase_50 AC 51 ms
63,592 KB
testcase_51 AC 51 ms
63,576 KB
testcase_52 AC 51 ms
63,576 KB
testcase_53 AC 51 ms
63,576 KB
testcase_54 AC 52 ms
63,576 KB
testcase_55 AC 53 ms
63,600 KB
testcase_56 AC 51 ms
63,576 KB
testcase_57 AC 53 ms
63,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, W = map(int, input().split())
w = [0] * n
v = [0] * n
for i in range(n):
    w[i], v[i] = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(n):
    for j in range(W + 1):
        if j >= w[i]:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - w[i]] + v[i])
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
for i in range(1, W + 1):
    print(dp[n][W] - dp[n][W - i] + 1)
0