結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー titiatitia
提出日時 2023-05-20 03:15:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,505 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 79,588 KB
最終ジャッジ日時 2023-08-23 05:04:20
合計ジャッジ時間 25,042 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
77,516 KB
testcase_01 WA -
testcase_02 AC 514 ms
79,588 KB
testcase_03 AC 397 ms
78,660 KB
testcase_04 AC 424 ms
78,704 KB
testcase_05 WA -
testcase_06 AC 380 ms
79,160 KB
testcase_07 AC 418 ms
79,044 KB
testcase_08 WA -
testcase_09 AC 503 ms
78,576 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 512 ms
78,412 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 328 ms
78,596 KB
testcase_17 AC 452 ms
78,420 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 421 ms
79,084 KB
testcase_21 AC 355 ms
78,376 KB
testcase_22 WA -
testcase_23 AC 378 ms
78,284 KB
testcase_24 WA -
testcase_25 AC 449 ms
79,184 KB
testcase_26 WA -
testcase_27 AC 414 ms
79,388 KB
testcase_28 AC 372 ms
78,688 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1,015 ms
78,856 KB
testcase_32 AC 1,014 ms
78,768 KB
testcase_33 AC 1,036 ms
78,752 KB
testcase_34 AC 1,014 ms
78,644 KB
testcase_35 AC 1,010 ms
78,764 KB
testcase_36 AC 98 ms
76,708 KB
testcase_37 AC 74 ms
71,180 KB
testcase_38 AC 138 ms
77,716 KB
testcase_39 AC 123 ms
77,544 KB
testcase_40 AC 112 ms
77,116 KB
testcase_41 AC 1,002 ms
77,600 KB
testcase_42 WA -
testcase_43 AC 454 ms
78,596 KB
testcase_44 AC 359 ms
78,216 KB
testcase_45 AC 382 ms
78,328 KB
testcase_46 AC 354 ms
78,604 KB
testcase_47 AC 196 ms
77,300 KB
testcase_48 AC 68 ms
71,640 KB
testcase_49 AC 71 ms
71,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

    # Wを使う回数で全探索
    for i in range(min(A0,B0,C0)+1):
        ANS=i*W
        A=A0-i
        B=B0-i
        C=C0-i

        # Xを使う回数で三分探索
        MIN=0
        MAX=min(A,B)

        while MAX>MIN+3:
            mid1=MIN+(MAX-MIN)//3
            mid2=MIN+(MAX-MIN)//3*2

            ANS1=ANS+mid1*X
            A1=A-mid1
            B1=B-mid1
            C1=C

            ANS11=ANS1+min(B1,C1)*Y
            ANS11+=min(A1,C1-min(B1,C1))*Z

            ANS12=ANS1+min(A1,C1)*Z
            ANS12+=min(B1,C1-min(A1,C1))*Y

            ANS2=ANS+mid2*X
            A1=A-mid2
            B1=B-mid2
            C1=C

            ANS21=ANS2+min(B1,C1)*Y
            ANS21+=min(A1,C1-min(B1,C1))*Z

            ANS22=ANS1+min(A1,C1)*Z
            ANS22+=min(B1,C1-min(A1,C1))*Y

            if max(ANS11,ANS12)>max(ANS21,ANS22):
                MAX=mid2
            else:
                MIN=mid1

        #print(i,MIN,MAX)

        for j in range(MIN,MAX+1):
            ANS1=ANS+j*X
            A1=A-j
            B1=B-j
            C1=C

            ANS11=ANS1+min(B1,C1)*Y
            ANS11+=min(A1,C1-min(B1,C1))*Z

            ANS12=ANS1+min(A1,C1)*Z
            ANS12+=min(B1,C1-min(A1,C1))*Y

            LANS=max(LANS,ANS11,ANS12)

    print(LANS)

            

            
            

            
0