結果

問題 No.2093 Shio Ramen
ユーザー flygonflygon
提出日時 2022-10-07 21:29:33
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 86,612 KB
実行使用メモリ 85,364 KB
最終ジャッジ日時 2023-09-03 00:17:37
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,352 KB
testcase_01 AC 63 ms
71,212 KB
testcase_02 AC 67 ms
71,380 KB
testcase_03 AC 68 ms
71,304 KB
testcase_04 AC 64 ms
71,432 KB
testcase_05 AC 63 ms
71,348 KB
testcase_06 AC 65 ms
71,348 KB
testcase_07 AC 65 ms
71,360 KB
testcase_08 AC 63 ms
71,108 KB
testcase_09 AC 78 ms
76,112 KB
testcase_10 AC 95 ms
76,520 KB
testcase_11 AC 76 ms
75,976 KB
testcase_12 AC 81 ms
76,456 KB
testcase_13 AC 82 ms
76,592 KB
testcase_14 AC 82 ms
76,716 KB
testcase_15 AC 90 ms
76,492 KB
testcase_16 AC 78 ms
76,364 KB
testcase_17 AC 89 ms
76,712 KB
testcase_18 AC 108 ms
84,692 KB
testcase_19 AC 93 ms
76,716 KB
testcase_20 AC 98 ms
76,648 KB
testcase_21 AC 96 ms
76,628 KB
testcase_22 AC 93 ms
76,720 KB
testcase_23 AC 106 ms
85,212 KB
testcase_24 AC 108 ms
85,344 KB
testcase_25 AC 106 ms
85,300 KB
testcase_26 AC 110 ms
85,184 KB
testcase_27 AC 109 ms
85,276 KB
testcase_28 AC 112 ms
85,364 KB
testcase_29 AC 105 ms
85,244 KB
testcase_30 AC 117 ms
85,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,I = map(int,input().split())
sa = [list(map(int,input().split())) for i in range(n)]
INF = 10**18
dp = [[-INF]*(I+1) for i in range(n+1)]
dp [0][0] = 0
for i in range(1, n+1):
  s,a = sa[i-1]
  for j in range(I+1):
    dp[i][j] = dp[i-1][j]
    if j < s: continue
    dp[i][j] = max(dp[i][j], dp[i-1][j-s] + a)
print(max(dp[-1]))
0