結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 Mizar
提出日時 2023-06-29 23:47:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-10-06 01:30:38
合計ジャッジ時間 7,310 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

def co_solve(n, a0, b0, a1, b1, a2, b2):
	return max([
		max([
			(dj // a0) * b0 + i * b1 + j * b2
			for j, dj in zip(range(a0), range(di, 0, -a2))
		])
		for i, di in zip(range(a0), range(n, 0, -a1))
	])

n = int(input())
a0, b0 = (int(x) for x in input().split())
a1, b1 = (int(x) for x in input().split())
a2, b2 = (int(x) for x in input().split())

result = max(
	co_solve(n, a0, b0, a1, b1, a2, b2),
	co_solve(n, a1, b1, a2, b2, a0, b0),
	co_solve(n, a2, b2, a0, b0, a1, b1),
)

print(result)
0