結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
76,096 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 211 ms
76,824 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 198 ms
76,744 KB
testcase_08 AC 211 ms
76,484 KB
testcase_09 WA -
testcase_10 AC 180 ms
76,540 KB
testcase_11 AC 194 ms
76,820 KB
testcase_12 AC 181 ms
76,212 KB
testcase_13 WA -
testcase_14 AC 195 ms
76,516 KB
testcase_15 WA -
testcase_16 AC 172 ms
76,448 KB
testcase_17 AC 202 ms
76,448 KB
testcase_18 AC 183 ms
76,252 KB
testcase_19 WA -
testcase_20 AC 169 ms
76,328 KB
testcase_21 AC 199 ms
76,552 KB
testcase_22 WA -
testcase_23 AC 176 ms
76,228 KB
testcase_24 AC 216 ms
76,284 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 201 ms
76,540 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 318 ms
76,484 KB
testcase_32 AC 305 ms
76,304 KB
testcase_33 AC 279 ms
76,556 KB
testcase_34 AC 297 ms
76,544 KB
testcase_35 AC 311 ms
76,504 KB
testcase_36 AC 87 ms
75,552 KB
testcase_37 AC 85 ms
75,672 KB
testcase_38 AC 102 ms
76,404 KB
testcase_39 AC 94 ms
75,732 KB
testcase_40 AC 94 ms
75,640 KB
testcase_41 AC 328 ms
76,780 KB
testcase_42 AC 345 ms
76,840 KB
testcase_43 AC 176 ms
76,144 KB
testcase_44 AC 155 ms
76,108 KB
testcase_45 AC 158 ms
76,148 KB
testcase_46 AC 146 ms
76,096 KB
testcase_47 AC 102 ms
76,068 KB
testcase_48 AC 84 ms
75,548 KB
testcase_49 AC 96 ms
75,508 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食売るときの最大売上を求める
        cnt=base + X*x; a,b,c=A-x,B-x,C
        if Y>Z:
            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
        else:
            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,c): x=min(a,c); cnt+=X*x
        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