結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー rlangevinrlangevin
提出日時 2023-05-19 22:22:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 3,000 ms
コード長 1,167 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 79,112 KB
最終ジャッジ日時 2023-08-23 00:16:38
合計ジャッジ時間 10,707 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
76,196 KB
testcase_01 AC 180 ms
78,136 KB
testcase_02 AC 225 ms
78,684 KB
testcase_03 AC 202 ms
78,852 KB
testcase_04 AC 171 ms
77,548 KB
testcase_05 AC 157 ms
77,880 KB
testcase_06 AC 180 ms
77,616 KB
testcase_07 AC 167 ms
78,164 KB
testcase_08 AC 173 ms
77,552 KB
testcase_09 AC 187 ms
77,816 KB
testcase_10 AC 152 ms
77,768 KB
testcase_11 AC 170 ms
77,588 KB
testcase_12 AC 196 ms
78,116 KB
testcase_13 AC 226 ms
79,112 KB
testcase_14 AC 203 ms
78,688 KB
testcase_15 AC 177 ms
78,364 KB
testcase_16 AC 177 ms
77,752 KB
testcase_17 AC 175 ms
77,972 KB
testcase_18 AC 181 ms
77,652 KB
testcase_19 AC 170 ms
78,172 KB
testcase_20 AC 165 ms
77,856 KB
testcase_21 AC 185 ms
77,812 KB
testcase_22 AC 189 ms
78,824 KB
testcase_23 AC 196 ms
78,352 KB
testcase_24 AC 194 ms
78,488 KB
testcase_25 AC 209 ms
78,564 KB
testcase_26 AC 181 ms
77,608 KB
testcase_27 AC 177 ms
77,976 KB
testcase_28 AC 199 ms
78,868 KB
testcase_29 AC 195 ms
78,304 KB
testcase_30 AC 198 ms
78,500 KB
testcase_31 AC 225 ms
78,540 KB
testcase_32 AC 231 ms
78,460 KB
testcase_33 AC 202 ms
78,268 KB
testcase_34 AC 212 ms
77,536 KB
testcase_35 AC 238 ms
78,672 KB
testcase_36 AC 86 ms
76,192 KB
testcase_37 AC 74 ms
71,316 KB
testcase_38 AC 92 ms
76,300 KB
testcase_39 AC 86 ms
76,236 KB
testcase_40 AC 87 ms
76,284 KB
testcase_41 AC 150 ms
77,176 KB
testcase_42 AC 133 ms
77,076 KB
testcase_43 AC 166 ms
77,708 KB
testcase_44 AC 152 ms
77,752 KB
testcase_45 AC 162 ms
77,856 KB
testcase_46 AC 168 ms
77,680 KB
testcase_47 AC 86 ms
76,332 KB
testcase_48 AC 71 ms
71,348 KB
testcase_49 AC 71 ms
71,240 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