結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 Mizar
提出日時 2023-06-30 00:02:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 640 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 44,604 KB
最終ジャッジ日時 2024-10-06 01:31:37
合計ジャッジ時間 26,717 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 47
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

def co_solve(n, a0, b0, a1, b1, a2, b2):
	r = 0
	for i, d in zip(range(a0), range(n, 0, -a1)):
		j = np.arange(0, min(a0, d // a2 + 1), dtype=np.uint64)
		v = np.amax(((d - j * a2) // a0) * b0 + i * b1 + j * b2)
		r = max(r, v)
	return r

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