結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー navel_tosnavel_tos
提出日時 2023-05-20 19:37:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,422 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 77,848 KB
最終ジャッジ日時 2023-08-23 09:50:42
合計ジャッジ時間 13,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
76,148 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 263 ms
77,080 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 241 ms
77,308 KB
testcase_08 AC 257 ms
76,788 KB
testcase_09 WA -
testcase_10 AC 219 ms
76,796 KB
testcase_11 AC 233 ms
76,916 KB
testcase_12 AC 230 ms
76,808 KB
testcase_13 WA -
testcase_14 AC 260 ms
76,988 KB
testcase_15 WA -
testcase_16 AC 203 ms
76,496 KB
testcase_17 AC 243 ms
77,168 KB
testcase_18 AC 236 ms
76,972 KB
testcase_19 WA -
testcase_20 AC 206 ms
76,928 KB
testcase_21 AC 228 ms
76,856 KB
testcase_22 WA -
testcase_23 AC 220 ms
77,008 KB
testcase_24 AC 274 ms
76,740 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 255 ms
77,156 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 365 ms
76,760 KB
testcase_32 AC 391 ms
77,084 KB
testcase_33 AC 324 ms
77,064 KB
testcase_34 AC 306 ms
77,100 KB
testcase_35 AC 339 ms
77,192 KB
testcase_36 AC 93 ms
75,716 KB
testcase_37 AC 94 ms
75,636 KB
testcase_38 AC 115 ms
76,760 KB
testcase_39 AC 101 ms
75,708 KB
testcase_40 AC 93 ms
75,628 KB
testcase_41 AC 348 ms
76,484 KB
testcase_42 AC 334 ms
76,848 KB
testcase_43 AC 234 ms
76,600 KB
testcase_44 AC 209 ms
76,636 KB
testcase_45 AC 219 ms
76,604 KB
testcase_46 AC 199 ms
76,724 KB
testcase_47 AC 107 ms
76,084 KB
testcase_48 AC 92 ms
75,748 KB
testcase_49 AC 130 ms
75,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yukicoder389E 夏の先取り

'''
方針は合っていそうなのでやりなおし。
添字ガチャにならないといいね。

base円を既に売り上げた状態で、「Wを一切売らないものとして」最大の売り上げを求める
関数を事前定義しよう。最初からこうすればよかったんだ。
'''
f=lambda:list(map(int,input().split()))

def yukicoder389E(A,B,C,X,Y,Z,base,sold=0):
    for x in range(min(A,B)+1):  #Xセットをx食売るときの最大売上を求める
        #1. Yから貪欲に売る
        cnt=base + X*x; a,b,c=A-x,B-x,C
        y=min(b,c); cnt+=Y*y; b-=y; c-=y
        if min(a,c): z=min(a,c); cnt+=Z*z; a-=z; c-=z
        if min(a,b): cnt+=X*min(a,b)
        sold=max(sold,cnt)

        #2. Zから貪欲に売る
        cnt=base + X*x; a,b,c=A-x,B-x,C
        z=min(a,c); cnt+=Z*z; a-=z; c-=z
        if min(b,c): y=min(b,c); cnt+=Y*y; b-=y; c-=y
        if min(a,b): cnt+=X*min(a,b)
        sold=max(sold,cnt)
    return sold

for _ in range(int(input())):
    A,B,C=f(); X,Y,Z,W=f(); ans=0; P=min(A,B,C)
    for A,B,C,X,Y,Z in [(A,B,C,X,Y,Z),(B,C,A,Y,Z,X),(C,A,B,Z,X,Y)]:
        if 1: ans=max(ans,yukicoder389E(A,B,C,X,Y,Z,0))
        if P: ans=max(ans,yukicoder389E(A-1,B-1,C-1,X,Y,Z,W))
        if P: ans=max(ans,yukicoder389E(A-P+1,B-P+1,C-P+1,X,Y,Z,W*(P-1)))
        if P: ans=max(ans,yukicoder389E(A-P,B-P,C-P,X,Y,Z,W*P))
    print(ans)
0