結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー navel_tosnavel_tos
提出日時 2023-05-20 19:37:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,422 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 76,864 KB
最終ジャッジ日時 2024-06-01 07:28:12
合計ジャッジ時間 11,601 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
75,164 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 234 ms
76,128 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 209 ms
75,992 KB
testcase_08 AC 229 ms
75,796 KB
testcase_09 WA -
testcase_10 AC 196 ms
75,908 KB
testcase_11 AC 201 ms
75,568 KB
testcase_12 AC 194 ms
75,776 KB
testcase_13 WA -
testcase_14 AC 233 ms
75,960 KB
testcase_15 WA -
testcase_16 AC 176 ms
75,780 KB
testcase_17 AC 214 ms
75,992 KB
testcase_18 AC 208 ms
75,664 KB
testcase_19 WA -
testcase_20 AC 176 ms
75,900 KB
testcase_21 AC 200 ms
75,692 KB
testcase_22 WA -
testcase_23 AC 188 ms
75,732 KB
testcase_24 AC 243 ms
76,080 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 225 ms
76,388 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 338 ms
75,872 KB
testcase_32 AC 360 ms
75,776 KB
testcase_33 AC 291 ms
75,732 KB
testcase_34 AC 281 ms
75,632 KB
testcase_35 AC 308 ms
75,728 KB
testcase_36 AC 65 ms
70,704 KB
testcase_37 AC 62 ms
67,604 KB
testcase_38 AC 85 ms
75,584 KB
testcase_39 AC 68 ms
69,796 KB
testcase_40 AC 62 ms
71,520 KB
testcase_41 AC 322 ms
75,580 KB
testcase_42 AC 308 ms
75,596 KB
testcase_43 AC 203 ms
75,524 KB
testcase_44 AC 183 ms
75,836 KB
testcase_45 AC 195 ms
76,240 KB
testcase_46 AC 172 ms
75,684 KB
testcase_47 AC 78 ms
75,056 KB
testcase_48 AC 59 ms
65,188 KB
testcase_49 AC 98 ms
67,384 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