結果

問題 No.2093 Shio Ramen
ユーザー MasKoaTSMasKoaTS
提出日時 2022-10-07 21:39:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 1,060 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 77,740 KB
最終ジャッジ日時 2023-09-03 00:54:43
合計ジャッジ時間 4,637 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,368 KB
testcase_01 AC 71 ms
71,416 KB
testcase_02 AC 73 ms
71,356 KB
testcase_03 AC 72 ms
71,372 KB
testcase_04 AC 72 ms
71,268 KB
testcase_05 AC 72 ms
71,376 KB
testcase_06 AC 72 ms
71,316 KB
testcase_07 AC 73 ms
71,472 KB
testcase_08 AC 73 ms
71,072 KB
testcase_09 AC 89 ms
76,492 KB
testcase_10 AC 110 ms
77,204 KB
testcase_11 AC 79 ms
75,912 KB
testcase_12 AC 93 ms
76,568 KB
testcase_13 AC 92 ms
76,956 KB
testcase_14 AC 94 ms
76,716 KB
testcase_15 AC 107 ms
77,060 KB
testcase_16 AC 89 ms
76,676 KB
testcase_17 AC 100 ms
76,800 KB
testcase_18 AC 121 ms
77,408 KB
testcase_19 AC 110 ms
77,392 KB
testcase_20 AC 107 ms
77,504 KB
testcase_21 AC 111 ms
77,740 KB
testcase_22 AC 110 ms
77,428 KB
testcase_23 AC 119 ms
77,384 KB
testcase_24 AC 120 ms
77,628 KB
testcase_25 AC 122 ms
77,504 KB
testcase_26 AC 118 ms
77,528 KB
testcase_27 AC 121 ms
77,568 KB
testcase_28 AC 117 ms
77,376 KB
testcase_29 AC 119 ms
77,540 KB
testcase_30 AC 122 ms
77,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
ramen = [list(map(int, input().split())) for _ in [0]*n]

dp = [-1] * (m + 1)
dp[0] = 0
for i in range(n):
	ndp = dp[:]
	for j in range(m):
		k = j + ramen[i][0]
		if(dp[j] == -1 or k > m):
			continue
		ndp[k] = max(ndp[k], dp[j] + ramen[i][1])
	dp = ndp[:]
	
print(max(dp))
0