結果

問題 No.2390 Udon Coupon (Hard)
ユーザー titiatitia
提出日時 2023-11-20 02:56:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 62,252 KB
最終ジャッジ日時 2023-11-20 02:56:32
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 41 ms
59,576 KB
testcase_02 AC 46 ms
59,584 KB
testcase_03 AC 42 ms
59,584 KB
testcase_04 AC 42 ms
59,584 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 36 ms
53,460 KB
testcase_09 AC 177 ms
62,252 KB
testcase_10 AC 42 ms
59,576 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 42 ms
59,584 KB
testcase_13 AC 41 ms
59,584 KB
testcase_14 AC 41 ms
59,584 KB
testcase_15 AC 37 ms
53,460 KB
testcase_16 AC 41 ms
59,584 KB
testcase_17 AC 42 ms
59,576 KB
testcase_18 AC 43 ms
59,584 KB
testcase_19 AC 53 ms
59,584 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 36 ms
53,460 KB
testcase_22 AC 41 ms
59,584 KB
testcase_23 AC 42 ms
59,584 KB
testcase_24 AC 79 ms
62,252 KB
testcase_25 AC 81 ms
62,252 KB
testcase_26 AC 78 ms
62,252 KB
testcase_27 AC 81 ms
62,252 KB
testcase_28 AC 76 ms
62,252 KB
testcase_29 AC 126 ms
62,252 KB
testcase_30 AC 116 ms
62,252 KB
testcase_31 AC 156 ms
62,252 KB
testcase_32 AC 124 ms
62,252 KB
testcase_33 AC 122 ms
62,252 KB
testcase_34 AC 192 ms
62,252 KB
testcase_35 AC 185 ms
62,252 KB
testcase_36 AC 179 ms
62,252 KB
testcase_37 AC 189 ms
62,252 KB
testcase_38 AC 182 ms
62,252 KB
testcase_39 AC 99 ms
62,252 KB
testcase_40 AC 82 ms
62,252 KB
testcase_41 AC 88 ms
62,252 KB
testcase_42 AC 80 ms
62,252 KB
testcase_43 AC 98 ms
62,252 KB
testcase_44 AC 82 ms
62,252 KB
testcase_45 AC 71 ms
62,252 KB
testcase_46 AC 51 ms
62,244 KB
testcase_47 AC 72 ms
62,252 KB
testcase_48 AC 84 ms
62,252 KB
testcase_49 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
AB=[list(map(int,input().split())) for i in range(3)]

AB.sort(reverse=True)

X=[AB[i][1]/AB[i][0] for i in range(3)]

MAX=max(X)
ind=X.index(MAX)

a,b=AB[ind]
xx=AB[0][0]*AB[1][0]*2

k=max(0,N-xx)//a

ANS=k*b
N-=k*a

ANS2=0
for i in range(N//AB[0][0]+1):
    rest=N-i*AB[0][0]
    for j in range(rest//AB[1][0]+1):
        ANS2=max(ANS2,i*AB[0][1]+j*AB[1][1]+(rest-j*AB[1][0])//AB[2][0]*AB[2][1])

print(ANS+ANS2)
0