結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 MizarMizar
提出日時 2023-07-08 15:25:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,398 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-06 01:44:52
合計ジャッジ時間 17,437 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
[[a1, b1], [a2, b2], [a3, b3]] = [list(map(int, input().split())) for _ in range(3)]
assert n > 0 and a1 > 0 and a2 > 0 and a3 > 0 and b1 > 0 and b2 > 0 and b3 > 0
if a2 * b1 < a1 * b2:
	a1, b1, a2, b2 = a2, b2, a1, b1
if a3 * b1 < a1 * b3:
	a1, b1, a3, b3 = a3, b3, a1, b1
print(
	max(
		t // a1 * b1 + p + q
		for p, s in zip(range(0, a1 * b2, b2), range(n, -1, -a2))
		for q, t in zip(range(0, a1 * b3, b3), range(s, -1, -a3))
	)
)
0