結果

問題 No.2317 Expression Menu
ユーザー ryohei22ryohei22
提出日時 2023-06-03 00:43:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,438 ms / 2,000 ms
コード長 762 bytes
コンパイル時間 842 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 299,480 KB
最終ジャッジ日時 2023-08-28 07:09:04
合計ジャッジ時間 44,498 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,560 KB
testcase_01 AC 69 ms
71,296 KB
testcase_02 AC 178 ms
91,948 KB
testcase_03 AC 1,230 ms
299,032 KB
testcase_04 AC 1,181 ms
298,960 KB
testcase_05 AC 1,232 ms
299,156 KB
testcase_06 AC 1,181 ms
299,152 KB
testcase_07 AC 1,244 ms
299,180 KB
testcase_08 AC 1,247 ms
298,912 KB
testcase_09 AC 1,237 ms
299,240 KB
testcase_10 AC 1,252 ms
299,056 KB
testcase_11 AC 1,244 ms
299,100 KB
testcase_12 AC 1,186 ms
299,248 KB
testcase_13 AC 1,235 ms
299,048 KB
testcase_14 AC 1,207 ms
298,896 KB
testcase_15 AC 1,153 ms
299,052 KB
testcase_16 AC 1,241 ms
299,164 KB
testcase_17 AC 1,098 ms
298,928 KB
testcase_18 AC 1,232 ms
299,020 KB
testcase_19 AC 1,247 ms
299,124 KB
testcase_20 AC 1,262 ms
299,220 KB
testcase_21 AC 1,196 ms
299,000 KB
testcase_22 AC 1,190 ms
298,952 KB
testcase_23 AC 1,437 ms
299,004 KB
testcase_24 AC 1,161 ms
299,072 KB
testcase_25 AC 1,148 ms
299,104 KB
testcase_26 AC 1,419 ms
299,028 KB
testcase_27 AC 1,426 ms
299,240 KB
testcase_28 AC 1,160 ms
299,016 KB
testcase_29 AC 1,158 ms
299,200 KB
testcase_30 AC 1,438 ms
299,480 KB
testcase_31 AC 1,425 ms
299,244 KB
testcase_32 AC 1,149 ms
299,096 KB
testcase_33 AC 70 ms
71,576 KB
testcase_34 AC 70 ms
71,280 KB
testcase_35 AC 79 ms
76,040 KB
testcase_36 AC 69 ms
71,352 KB
testcase_37 AC 70 ms
71,292 KB
testcase_38 AC 1,299 ms
298,856 KB
testcase_39 AC 1,332 ms
299,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(N)]

# dp[i][j][j]: i番目の機能までの実装/非実装が確定しており、メニュー枠をi、容量をj消費している時にあげられる可愛さの最大値。
# 初期化: dp[i][j][k] = 0
# 答え: max[0<=x<=X, 0<=y<=Y]{dp[N][x][y]}

dp = [[[0] * (Y + 1) for _ in range(X+1)] for _ in range(N+1)]
for i in range(N):
	a, b, c = A[i]
	for x in range(X+1):
		for y in range(Y+1):
			dp[i+1][x][y] = max(dp[i+1][x][y], dp[i][x][y])
			if x + a <= X and y + b <= Y:
				dp[i+1][x+a][y+b] = max(dp[i][x+a][y+b], dp[i][x][y] + c)

# import pprint; pprint.pprint(dp)
ans = 0
for x in range(X+1):
	for y in range(Y+1):
		ans = max(ans, dp[N][x][y])
print(ans)
0