結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー titiatitia
提出日時 2023-05-20 02:02:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,548 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 8,440 KB
最終ジャッジ日時 2023-08-23 04:37:28
合計ジャッジ時間 3,292 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 19 ms
8,320 KB
testcase_21 AC 18 ms
8,292 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 19 ms
8,348 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 19 ms
8,392 KB
testcase_37 AC 19 ms
8,376 KB
testcase_38 AC 18 ms
8,420 KB
testcase_39 AC 19 ms
8,384 KB
testcase_40 AC 18 ms
8,328 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 17 ms
8,416 KB
testcase_49 AC 17 ms
8,320 KB
権限があれば一括ダウンロードができます

ソースコード

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:
        A=A0
        B=B0
        C=C0
        ANS=0
        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)

        if A0>0 and B0>0 and C0>0:
            A=A0-1
            B=B0-1
            C=C0-1
            ANS=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