結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー ShirotsumeShirotsume
提出日時 2023-03-15 21:23:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 343 ms / 3,000 ms
コード長 1,020 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 77,164 KB
最終ジャッジ日時 2023-10-18 12:33:56
合計ジャッジ時間 11,479 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,812 KB
testcase_01 AC 210 ms
76,740 KB
testcase_02 AC 229 ms
77,164 KB
testcase_03 AC 202 ms
76,836 KB
testcase_04 AC 212 ms
76,804 KB
testcase_05 AC 175 ms
76,636 KB
testcase_06 AC 188 ms
76,724 KB
testcase_07 AC 184 ms
76,628 KB
testcase_08 AC 193 ms
76,656 KB
testcase_09 AC 208 ms
76,724 KB
testcase_10 AC 170 ms
76,612 KB
testcase_11 AC 193 ms
76,848 KB
testcase_12 AC 215 ms
76,948 KB
testcase_13 AC 230 ms
76,948 KB
testcase_14 AC 198 ms
76,904 KB
testcase_15 AC 167 ms
76,440 KB
testcase_16 AC 178 ms
76,700 KB
testcase_17 AC 198 ms
76,868 KB
testcase_18 AC 212 ms
76,884 KB
testcase_19 AC 163 ms
76,476 KB
testcase_20 AC 187 ms
76,708 KB
testcase_21 AC 184 ms
76,780 KB
testcase_22 AC 188 ms
76,720 KB
testcase_23 AC 200 ms
76,860 KB
testcase_24 AC 235 ms
76,880 KB
testcase_25 AC 202 ms
76,880 KB
testcase_26 AC 217 ms
76,840 KB
testcase_27 AC 196 ms
76,764 KB
testcase_28 AC 207 ms
76,820 KB
testcase_29 AC 219 ms
77,128 KB
testcase_30 AC 192 ms
76,604 KB
testcase_31 AC 340 ms
76,896 KB
testcase_32 AC 343 ms
76,924 KB
testcase_33 AC 313 ms
76,780 KB
testcase_34 AC 306 ms
76,676 KB
testcase_35 AC 331 ms
76,916 KB
testcase_36 AC 61 ms
72,528 KB
testcase_37 AC 43 ms
55,652 KB
testcase_38 AC 81 ms
76,000 KB
testcase_39 AC 65 ms
70,512 KB
testcase_40 AC 62 ms
68,440 KB
testcase_41 AC 261 ms
76,368 KB
testcase_42 AC 247 ms
76,220 KB
testcase_43 AC 192 ms
76,664 KB
testcase_44 AC 153 ms
76,360 KB
testcase_45 AC 161 ms
76,428 KB
testcase_46 AC 163 ms
76,504 KB
testcase_47 AC 78 ms
75,796 KB
testcase_48 AC 42 ms
55,652 KB
testcase_49 AC 43 ms
55,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
for _ in range(ii()):
    r, g, b = mi()

    z, x, y, w = mi()
    ans = 0
    def check(i):
        global r, g, b, w, x, y, z
        ans = 0
        xyztime = i // 2
        wtime = i % 2
        r -= i
        g -= i 
        b -= i
        now = xyztime * max(2 * w, x + y + z) + wtime * w
        for _ in range(3):
                g1 = min(r, g)
                g2 = g-g1
                ans = max(ans, now + z * min(g1, r) + x * min(g2, b))
                g2 = min(g, b)
                g1 = g-g2
                ans = max(ans, now + z * min(g1, r) + x * min(g2, b))
                r, g, b = g, b, r
                x, y, z = y, z, x
        r += i
        g += i 
        b += i
        return ans


    for i in range(0, min(r, g, b) + 1):
        ans = max(ans, check(i))

    print(ans)
0