結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー titiatitia
提出日時 2023-05-20 02:27:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,638 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 82,140 KB
最終ジャッジ日時 2023-08-23 04:48:20
合計ジャッジ時間 77,524 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 355 ms
78,348 KB
testcase_01 AC 2,824 ms
80,900 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2,440 ms
81,712 KB
testcase_05 AC 2,203 ms
81,356 KB
testcase_06 AC 2,148 ms
80,840 KB
testcase_07 AC 2,255 ms
81,564 KB
testcase_08 AC 2,516 ms
81,300 KB
testcase_09 AC 2,565 ms
80,184 KB
testcase_10 AC 1,958 ms
80,712 KB
testcase_11 AC 2,403 ms
81,660 KB
testcase_12 AC 2,254 ms
80,452 KB
testcase_13 AC 2,873 ms
80,480 KB
testcase_14 AC 2,086 ms
80,800 KB
testcase_15 AC 2,302 ms
79,636 KB
testcase_16 AC 1,786 ms
80,324 KB
testcase_17 AC 2,438 ms
81,124 KB
testcase_18 AC 2,437 ms
79,996 KB
testcase_19 WA -
testcase_20 AC 2,063 ms
79,864 KB
testcase_21 AC 1,938 ms
80,328 KB
testcase_22 AC 1,848 ms
80,324 KB
testcase_23 AC 1,982 ms
80,772 KB
testcase_24 AC 2,924 ms
81,236 KB
testcase_25 WA -
testcase_26 TLE -
testcase_27 AC 2,099 ms
80,184 KB
testcase_28 AC 2,285 ms
81,348 KB
testcase_29 AC 2,485 ms
80,340 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from itertools import permutations

def calc1(A,B,C,ANS):
    M=min(A,B)
    A-=M
    B-=M
    ANS+=M*X
    return A,B,C,ANS

def calc2(A,B,C,ANS):
    M=min(B,C)
    B-=M
    C-=M
    ANS+=M*Y
    return A,B,C,ANS

def calc3(A,B,C,ANS):
    M=min(C,A)
    C-=M
    A-=M
    ANS+=M*Z
    return A,B,C,ANS

def calc4(A,B,C,ANS):
    M=min(A,B,C)
    A-=M
    B-=M
    C-=M
    ANS+=M*W
    return A,B,C,ANS
    

T=int(input())
for tests in range(T):
    A0,B0,C0=map(int,input().split())
    X,Y,Z,W=map(int,input().split())
    LANS=0

    L=list(permutations(range(4)))

    for lx in L:
        for k in range(min(A0,B0)+1):           
            A=A0-k
            B=B0-k
            C=C0
            ANS=k*X
            for com in lx:
                if com==0:
                    A,B,C,ANS=calc1(A,B,C,ANS)
                if com==1:
                    A,B,C,ANS=calc2(A,B,C,ANS)
                if com==2:
                    A,B,C,ANS=calc3(A,B,C,ANS)
                if com==3:
                    A,B,C,ANS=calc4(A,B,C,ANS)

            LANS=max(ANS,LANS)

        for k in range(min(B0,C0)+1):           
            A=A0
            B=B0-k
            C=C0-k
            ANS=k*Y
            for com in lx:
                if com==0:
                    A,B,C,ANS=calc1(A,B,C,ANS)
                if com==1:
                    A,B,C,ANS=calc2(A,B,C,ANS)
                if com==2:
                    A,B,C,ANS=calc3(A,B,C,ANS)
                if com==3:
                    A,B,C,ANS=calc4(A,B,C,ANS)

            LANS=max(ANS,LANS)

        for k in range(min(C0,A0)+1):           
            A=A0-k
            B=B0
            C=C0-k
            ANS=k*Z
            for com in lx:
                if com==0:
                    A,B,C,ANS=calc1(A,B,C,ANS)
                if com==1:
                    A,B,C,ANS=calc2(A,B,C,ANS)
                if com==2:
                    A,B,C,ANS=calc3(A,B,C,ANS)
                if com==3:
                    A,B,C,ANS=calc4(A,B,C,ANS)

            LANS=max(ANS,LANS)

        for k in range(min(A0,B0,C0)+1):           
            A=A0-k
            B=B0-k
            C=C0-k
            ANS=k*W
            for com in lx:
                if com==0:
                    A,B,C,ANS=calc1(A,B,C,ANS)
                if com==1:
                    A,B,C,ANS=calc2(A,B,C,ANS)
                if com==2:
                    A,B,C,ANS=calc3(A,B,C,ANS)
                if com==3:
                    A,B,C,ANS=calc4(A,B,C,ANS)

            LANS=max(ANS,LANS)


    print(LANS)
                
        

    

    

    
            
    

    
0