結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 MizarMizar
提出日時 2023-06-29 18:34:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 754 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,488 KB
最終ジャッジ日時 2024-04-15 20:46:20
合計ジャッジ時間 31,951 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 505 ms
43,980 KB
testcase_01 AC 496 ms
43,852 KB
testcase_02 AC 501 ms
44,356 KB
testcase_03 AC 496 ms
44,228 KB
testcase_04 AC 505 ms
44,224 KB
testcase_05 AC 559 ms
44,488 KB
testcase_06 AC 500 ms
43,968 KB
testcase_07 AC 503 ms
44,232 KB
testcase_08 AC 501 ms
43,852 KB
testcase_09 AC 677 ms
43,848 KB
testcase_10 AC 501 ms
44,232 KB
testcase_11 AC 509 ms
43,848 KB
testcase_12 AC 512 ms
43,976 KB
testcase_13 AC 511 ms
43,968 KB
testcase_14 AC 502 ms
44,232 KB
testcase_15 AC 506 ms
43,884 KB
testcase_16 AC 500 ms
44,224 KB
testcase_17 AC 508 ms
43,884 KB
testcase_18 AC 502 ms
44,068 KB
testcase_19 AC 499 ms
43,968 KB
testcase_20 AC 493 ms
44,228 KB
testcase_21 AC 500 ms
43,848 KB
testcase_22 AC 500 ms
44,100 KB
testcase_23 AC 509 ms
44,104 KB
testcase_24 AC 590 ms
43,840 KB
testcase_25 AC 583 ms
43,884 KB
testcase_26 AC 585 ms
44,096 KB
testcase_27 AC 588 ms
43,976 KB
testcase_28 AC 584 ms
43,848 KB
testcase_29 AC 636 ms
44,352 KB
testcase_30 AC 624 ms
43,976 KB
testcase_31 AC 651 ms
43,716 KB
testcase_32 AC 639 ms
44,244 KB
testcase_33 AC 624 ms
43,972 KB
testcase_34 AC 754 ms
43,972 KB
testcase_35 AC 698 ms
44,228 KB
testcase_36 AC 697 ms
43,968 KB
testcase_37 AC 699 ms
44,228 KB
testcase_38 AC 697 ms
43,712 KB
testcase_39 AC 588 ms
44,104 KB
testcase_40 AC 566 ms
44,112 KB
testcase_41 AC 589 ms
44,360 KB
testcase_42 AC 573 ms
43,712 KB
testcase_43 AC 584 ms
44,360 KB
testcase_44 AC 566 ms
44,100 KB
testcase_45 AC 556 ms
44,224 KB
testcase_46 AC 538 ms
43,724 KB
testcase_47 AC 547 ms
44,104 KB
testcase_48 AC 575 ms
43,852 KB
testcase_49 AC 504 ms
43,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

def co_solve(n, a0, b0, a1, b1, a2, b2):
	r = 0
	for i in range(min(a0, n // a1 + 1)):
		d = n - i * a1
		jmax = min(a0, d // a2 + 1)
		j = np.arange(0, jmax, dtype=np.uint64)
		t = ((d - j * a2) // a0) * b0 + i * b1 + j * b2
		r = max(r, np.amax(t))
	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