結果

問題 No.2232 Miser's Gift
ユーザー ShirotsumeShirotsume
提出日時 2023-03-03 21:25:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 672 bytes
コンパイル時間 1,274 ms
コンパイル使用メモリ 81,504 KB
実行使用メモリ 163,084 KB
最終ジャッジ日時 2023-10-18 01:17:05
合計ジャッジ時間 15,073 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,356 KB
testcase_01 AC 41 ms
55,356 KB
testcase_02 AC 41 ms
55,356 KB
testcase_03 AC 298 ms
162,904 KB
testcase_04 AC 321 ms
162,936 KB
testcase_05 AC 93 ms
83,964 KB
testcase_06 AC 42 ms
55,360 KB
testcase_07 AC 81 ms
84,788 KB
testcase_08 AC 306 ms
162,936 KB
testcase_09 AC 309 ms
162,936 KB
testcase_10 AC 306 ms
162,936 KB
testcase_11 AC 350 ms
162,936 KB
testcase_12 AC 311 ms
162,936 KB
testcase_13 AC 292 ms
162,936 KB
testcase_14 AC 290 ms
162,936 KB
testcase_15 AC 293 ms
162,936 KB
testcase_16 AC 294 ms
162,936 KB
testcase_17 AC 293 ms
163,084 KB
testcase_18 AC 290 ms
162,936 KB
testcase_19 AC 296 ms
162,936 KB
testcase_20 AC 290 ms
162,936 KB
testcase_21 AC 291 ms
162,936 KB
testcase_22 AC 294 ms
162,936 KB
testcase_23 AC 345 ms
162,936 KB
testcase_24 AC 346 ms
162,936 KB
testcase_25 AC 341 ms
162,936 KB
testcase_26 AC 337 ms
162,936 KB
testcase_27 AC 344 ms
162,936 KB
testcase_28 AC 321 ms
162,936 KB
testcase_29 AC 318 ms
162,936 KB
testcase_30 AC 320 ms
162,936 KB
testcase_31 AC 343 ms
162,936 KB
testcase_32 AC 346 ms
162,936 KB
testcase_33 AC 294 ms
162,936 KB
testcase_34 AC 293 ms
162,936 KB
testcase_35 AC 293 ms
162,936 KB
testcase_36 AC 296 ms
162,936 KB
testcase_37 AC 294 ms
162,936 KB
testcase_38 AC 63 ms
67,992 KB
testcase_39 AC 62 ms
67,992 KB
testcase_40 AC 63 ms
67,992 KB
testcase_41 AC 61 ms
67,992 KB
testcase_42 AC 61 ms
67,992 KB
testcase_43 AC 62 ms
67,992 KB
testcase_44 AC 62 ms
67,992 KB
testcase_45 AC 61 ms
67,992 KB
testcase_46 AC 61 ms
67,992 KB
testcase_47 AC 62 ms
67,992 KB
testcase_48 AC 53 ms
63,676 KB
testcase_49 AC 51 ms
63,676 KB
testcase_50 AC 51 ms
63,672 KB
testcase_51 AC 52 ms
63,672 KB
testcase_52 AC 52 ms
63,672 KB
testcase_53 AC 51 ms
63,676 KB
testcase_54 AC 53 ms
63,692 KB
testcase_55 AC 52 ms
63,676 KB
testcase_56 AC 53 ms
63,676 KB
testcase_57 AC 53 ms
63,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, w = mi()
dp = [[-inf] * (w + 1) for _ in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    u, v = mi()
    for j in range(w + 1):
        if j + u <= w:
            dp[i + 1][j + u] = max(dp[i][j] + v, dp[i + 1][j + u])
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])

for i in range(1, w + 1):
    dp[n][i] = max(dp[n][i], dp[n][i - 1])
ans = []
for i in range(1, w + 1):
    ans.append(dp[n][w] - dp[n][w - i] + 1)

for v in ans:
    print(v)
0