結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー rlangevinrlangevin
提出日時 2023-05-19 22:22:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 210 ms / 3,000 ms
コード長 1,167 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 78,032 KB
最終ジャッジ日時 2024-05-10 05:49:58
合計ジャッジ時間 9,451 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
63,872 KB
testcase_01 AC 158 ms
76,672 KB
testcase_02 AC 198 ms
78,032 KB
testcase_03 AC 173 ms
77,072 KB
testcase_04 AC 144 ms
76,364 KB
testcase_05 AC 136 ms
76,544 KB
testcase_06 AC 156 ms
76,884 KB
testcase_07 AC 145 ms
76,672 KB
testcase_08 AC 149 ms
76,760 KB
testcase_09 AC 161 ms
76,672 KB
testcase_10 AC 128 ms
76,416 KB
testcase_11 AC 144 ms
76,800 KB
testcase_12 AC 170 ms
76,800 KB
testcase_13 AC 197 ms
77,288 KB
testcase_14 AC 177 ms
76,960 KB
testcase_15 AC 155 ms
76,864 KB
testcase_16 AC 151 ms
76,908 KB
testcase_17 AC 150 ms
76,544 KB
testcase_18 AC 161 ms
76,624 KB
testcase_19 AC 146 ms
76,608 KB
testcase_20 AC 142 ms
76,800 KB
testcase_21 AC 162 ms
76,792 KB
testcase_22 AC 163 ms
76,660 KB
testcase_23 AC 170 ms
76,908 KB
testcase_24 AC 168 ms
76,672 KB
testcase_25 AC 182 ms
77,096 KB
testcase_26 AC 156 ms
76,928 KB
testcase_27 AC 154 ms
76,544 KB
testcase_28 AC 169 ms
76,544 KB
testcase_29 AC 172 ms
77,168 KB
testcase_30 AC 172 ms
76,864 KB
testcase_31 AC 198 ms
76,800 KB
testcase_32 AC 200 ms
76,784 KB
testcase_33 AC 173 ms
76,416 KB
testcase_34 AC 187 ms
76,544 KB
testcase_35 AC 210 ms
76,936 KB
testcase_36 AC 59 ms
64,256 KB
testcase_37 AC 41 ms
52,352 KB
testcase_38 AC 66 ms
66,048 KB
testcase_39 AC 60 ms
64,512 KB
testcase_40 AC 58 ms
64,384 KB
testcase_41 AC 129 ms
75,904 KB
testcase_42 AC 109 ms
73,600 KB
testcase_43 AC 143 ms
76,672 KB
testcase_44 AC 129 ms
76,180 KB
testcase_45 AC 140 ms
76,544 KB
testcase_46 AC 147 ms
76,544 KB
testcase_47 AC 58 ms
62,848 KB
testcase_48 AC 40 ms
52,224 KB
testcase_49 AC 40 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T = int(input())
for _ in range(T):
    A, B, C = map(int, input().split())
    X, Y, Z, W = map(int, input().split())
    ans = 0
    for i in range(min(A, B, C) + 1):
        now = W * (i % 2) + max(2 * W, X + Y + Z) * (i // 2)
        tA, tB, tC = A - i, B - i, C - i
        now += X * min(tA, tB)
        tA, tB = A - min(A, B), B - min(A, B)
        if tA:
            now += Z * min(tA, tC)
        else:
            now += Y * min(tB, tC)
        ans = max(now, ans)
        
        now = W * (i % 2) + max(2 * W, X + Y + Z) * (i // 2)
        tA, tB, tC = A - i, B - i, C - i
        now += Y * min(tB, tC)
        tB, tC = B - min(B, C), C - min(B, C)
        if tB:
            now += X * min(tA, tB)
        else:
            now += Z * min(tA, tC)
        ans = max(now, ans)
        
        now = W * (i % 2) + max(2 * W, X + Y + Z) * (i // 2)
        tA, tB, tC = A - i, B - i, C - i
        now += Z * min(tA, tC)
        tA, tC = A - min(A, C), C - min(A, C)
        if tA:
            now += X * min(tA, tB)
        else:
            now += Y * min(tB, tC)
        ans = max(now, ans)
        
    print(ans)
0