結果

問題 No.2232 Miser's Gift
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-03-03 18:43:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 507 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 156,040 KB
最終ジャッジ日時 2023-10-18 01:12:31
合計ジャッジ時間 17,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,304 KB
testcase_01 AC 38 ms
53,304 KB
testcase_02 AC 38 ms
53,304 KB
testcase_03 AC 389 ms
156,040 KB
testcase_04 AC 380 ms
156,040 KB
testcase_05 AC 100 ms
83,712 KB
testcase_06 AC 37 ms
53,308 KB
testcase_07 AC 70 ms
78,148 KB
testcase_08 AC 404 ms
156,040 KB
testcase_09 AC 410 ms
156,040 KB
testcase_10 AC 404 ms
156,040 KB
testcase_11 AC 467 ms
156,040 KB
testcase_12 AC 409 ms
156,040 KB
testcase_13 AC 383 ms
156,040 KB
testcase_14 AC 383 ms
156,040 KB
testcase_15 AC 386 ms
156,040 KB
testcase_16 AC 395 ms
156,040 KB
testcase_17 AC 383 ms
156,040 KB
testcase_18 AC 385 ms
156,040 KB
testcase_19 AC 384 ms
156,040 KB
testcase_20 AC 388 ms
156,040 KB
testcase_21 AC 384 ms
156,040 KB
testcase_22 AC 384 ms
156,040 KB
testcase_23 AC 498 ms
156,040 KB
testcase_24 AC 495 ms
156,036 KB
testcase_25 AC 442 ms
156,040 KB
testcase_26 AC 507 ms
156,040 KB
testcase_27 AC 491 ms
156,040 KB
testcase_28 AC 400 ms
156,040 KB
testcase_29 AC 444 ms
156,040 KB
testcase_30 AC 399 ms
156,040 KB
testcase_31 AC 443 ms
156,040 KB
testcase_32 AC 400 ms
156,040 KB
testcase_33 AC 387 ms
156,040 KB
testcase_34 AC 391 ms
156,040 KB
testcase_35 AC 391 ms
156,040 KB
testcase_36 AC 385 ms
156,040 KB
testcase_37 AC 393 ms
156,040 KB
testcase_38 AC 61 ms
65,916 KB
testcase_39 AC 61 ms
65,916 KB
testcase_40 AC 61 ms
65,916 KB
testcase_41 AC 61 ms
65,916 KB
testcase_42 AC 62 ms
67,988 KB
testcase_43 AC 61 ms
65,916 KB
testcase_44 AC 63 ms
67,992 KB
testcase_45 AC 62 ms
67,988 KB
testcase_46 AC 62 ms
67,988 KB
testcase_47 AC 59 ms
65,912 KB
testcase_48 AC 51 ms
61,620 KB
testcase_49 AC 50 ms
61,592 KB
testcase_50 AC 53 ms
63,672 KB
testcase_51 AC 52 ms
61,620 KB
testcase_52 AC 52 ms
63,668 KB
testcase_53 AC 52 ms
63,668 KB
testcase_54 AC 52 ms
61,620 KB
testcase_55 AC 54 ms
63,680 KB
testcase_56 AC 52 ms
63,668 KB
testcase_57 AC 52 ms
63,672 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 i in range(N+1)]

for i in range(1, N+1):
  for j in range(0, W+1):
    dp[i][j] = max(dp[i][j], dp[i-1][j])
    if j >= w[i-1]:
        dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]]+v[i-1])
        
for X in range(1, W+1):
  print(dp[N][W]-dp[N][W-X]+1)
0