結果

問題 No.2390 Udon Coupon (Hard)
ユーザー rikein12rikein12
提出日時 2023-11-03 20:24:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 93,392 KB
最終ジャッジ日時 2023-11-03 20:24:50
合計ジャッジ時間 8,641 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
60,836 KB
testcase_01 AC 44 ms
60,836 KB
testcase_02 AC 139 ms
91,304 KB
testcase_03 AC 139 ms
91,304 KB
testcase_04 AC 133 ms
91,304 KB
testcase_05 AC 42 ms
60,052 KB
testcase_06 AC 135 ms
91,304 KB
testcase_07 AC 36 ms
53,620 KB
testcase_08 AC 36 ms
53,620 KB
testcase_09 AC 179 ms
93,372 KB
testcase_10 AC 46 ms
60,824 KB
testcase_11 AC 42 ms
59,904 KB
testcase_12 AC 46 ms
62,484 KB
testcase_13 AC 41 ms
60,216 KB
testcase_14 AC 45 ms
60,920 KB
testcase_15 AC 42 ms
59,904 KB
testcase_16 AC 46 ms
61,028 KB
testcase_17 AC 40 ms
59,904 KB
testcase_18 AC 42 ms
60,332 KB
testcase_19 AC 41 ms
60,324 KB
testcase_20 AC 36 ms
53,620 KB
testcase_21 AC 35 ms
53,620 KB
testcase_22 AC 134 ms
91,304 KB
testcase_23 AC 133 ms
91,304 KB
testcase_24 AC 158 ms
91,312 KB
testcase_25 AC 133 ms
91,312 KB
testcase_26 AC 134 ms
91,312 KB
testcase_27 AC 133 ms
91,312 KB
testcase_28 AC 133 ms
91,312 KB
testcase_29 AC 165 ms
93,392 KB
testcase_30 AC 164 ms
93,392 KB
testcase_31 AC 190 ms
93,392 KB
testcase_32 AC 166 ms
93,392 KB
testcase_33 AC 166 ms
93,392 KB
testcase_34 AC 166 ms
93,392 KB
testcase_35 AC 167 ms
93,392 KB
testcase_36 AC 166 ms
93,392 KB
testcase_37 AC 167 ms
93,392 KB
testcase_38 AC 169 ms
93,392 KB
testcase_39 AC 126 ms
88,812 KB
testcase_40 AC 134 ms
91,312 KB
testcase_41 AC 135 ms
91,312 KB
testcase_42 AC 132 ms
91,312 KB
testcase_43 AC 133 ms
91,312 KB
testcase_44 AC 133 ms
91,312 KB
testcase_45 AC 151 ms
91,312 KB
testcase_46 AC 134 ms
91,304 KB
testcase_47 AC 133 ms
91,312 KB
testcase_48 AC 133 ms
91,312 KB
testcase_49 AC 35 ms
53,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = min(4000000,N)
DP = [- 10**9]*(M+1)
DP[0] = 0
A = [list(map(int,input().split())) for i in range(3)]
A = [(b/a,a,b) for a,b in A]

A.sort(key=lambda x:x[0])

_,a,b = A[0]

i = 1
while a*i <= M:
    DP[a*i] = b*i
    i+=1

_,a,b = A[1]
ans = 0
for i in range(M+1):
    if i>=a:
        DP[i] = max(DP[i-a]+b,DP[i])
    ans = max(ans,((N-i)//A[2][1])*A[2][2]+DP[i])

print(ans)
0