結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 MizarMizar
提出日時 2023-06-30 00:02:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 706 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,732 KB
最終ジャッジ日時 2024-04-15 20:47:17
合計ジャッジ時間 30,314 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 521 ms
44,224 KB
testcase_01 AC 506 ms
44,228 KB
testcase_02 AC 511 ms
44,600 KB
testcase_03 AC 510 ms
44,348 KB
testcase_04 AC 512 ms
44,484 KB
testcase_05 AC 557 ms
43,976 KB
testcase_06 AC 495 ms
43,968 KB
testcase_07 AC 498 ms
44,348 KB
testcase_08 AC 498 ms
44,480 KB
testcase_09 AC 683 ms
44,096 KB
testcase_10 AC 507 ms
44,360 KB
testcase_11 AC 504 ms
43,964 KB
testcase_12 AC 503 ms
44,352 KB
testcase_13 AC 512 ms
44,732 KB
testcase_14 AC 511 ms
44,348 KB
testcase_15 AC 501 ms
44,216 KB
testcase_16 AC 501 ms
44,356 KB
testcase_17 AC 502 ms
43,976 KB
testcase_18 AC 518 ms
44,480 KB
testcase_19 AC 514 ms
44,348 KB
testcase_20 AC 504 ms
44,476 KB
testcase_21 AC 501 ms
44,216 KB
testcase_22 AC 523 ms
44,092 KB
testcase_23 AC 529 ms
44,352 KB
testcase_24 AC 596 ms
44,472 KB
testcase_25 AC 575 ms
44,356 KB
testcase_26 AC 575 ms
44,348 KB
testcase_27 AC 574 ms
44,476 KB
testcase_28 AC 564 ms
44,096 KB
testcase_29 AC 639 ms
44,352 KB
testcase_30 AC 624 ms
44,612 KB
testcase_31 AC 645 ms
44,348 KB
testcase_32 AC 649 ms
44,352 KB
testcase_33 AC 641 ms
44,228 KB
testcase_34 AC 697 ms
44,352 KB
testcase_35 AC 699 ms
44,476 KB
testcase_36 AC 697 ms
44,348 KB
testcase_37 AC 690 ms
43,968 KB
testcase_38 AC 706 ms
44,604 KB
testcase_39 AC 584 ms
44,472 KB
testcase_40 AC 577 ms
44,348 KB
testcase_41 AC 590 ms
44,348 KB
testcase_42 AC 561 ms
44,100 KB
testcase_43 AC 578 ms
44,480 KB
testcase_44 AC 558 ms
44,092 KB
testcase_45 AC 558 ms
44,348 KB
testcase_46 AC 535 ms
43,968 KB
testcase_47 AC 556 ms
44,416 KB
testcase_48 AC 573 ms
44,220 KB
testcase_49 AC 494 ms
44,352 KB
権限があれば一括ダウンロードができます

ソースコード

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