Submission #51394723


Source Code Expand

Copy
#ARC174_20240317_B
T=int(input())
for _ in range(T):
A1,A2,A3,A4,A5=map(int,input().split())
P1,P2,P3,P4,P5=map(int,input().split())
C=A1*2+A2-A4+A5*-2
if(C<=0):
print(0)
else:
if(C%2==0):
ans1=P5*(C//2)
ans2=P4*C
ans=min(ans1,ans2)
else:
ans1=P5*(C//2)+P4
ans2=P4*C
ans3=P5*(C//2)+P5
ans=min(ans1,ans2,ans3)
print(ans)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#ARC174_20240317_B
T=int(input())
for _ in range(T):
    A1,A2,A3,A4,A5=map(int,input().split())
    P1,P2,P3,P4,P5=map(int,input().split())
    C=A1*2+A2-A4+A5*-2
    if(C<=0):
        print(0)
    else:
        if(C%2==0):
            ans1=P5*(C//2)
            ans2=P4*C
            ans=min(ans1,ans2)
        else:
            ans1=P5*(C//2)+P4
            ans2=P4*C
            ans3=P5*(C//2)+P5
            ans=min(ans1,ans2,ans3)
        print(ans)

Submission Info

Submission Time
Task B - Bought Review
User Konini
Language Python (PyPy 3.10-v7.3.12)
Score 300
Code Size 475 Byte
Status AC
Exec Time 178 ms
Memory 88284 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 40
Set Name Test Cases
Sample sample_01.txt
All sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt
Case Name Status Exec Time Memory
sample_01.txt AC 58 ms 76460 KB
test_01.txt AC 57 ms 76648 KB
test_02.txt AC 58 ms 76180 KB
test_03.txt AC 178 ms 88284 KB
test_04.txt AC 155 ms 85836 KB
test_05.txt AC 177 ms 88124 KB
test_06.txt AC 156 ms 85444 KB
test_07.txt AC 172 ms 87060 KB
test_08.txt AC 148 ms 85688 KB
test_09.txt AC 146 ms 86632 KB
test_10.txt AC 152 ms 86404 KB
test_11.txt AC 146 ms 86128 KB
test_12.txt AC 152 ms 86336 KB
test_13.txt AC 147 ms 86572 KB
test_14.txt AC 151 ms 86276 KB
test_15.txt AC 146 ms 86540 KB
test_16.txt AC 151 ms 86320 KB
test_17.txt AC 146 ms 86328 KB
test_18.txt AC 152 ms 86172 KB
test_19.txt AC 132 ms 84436 KB
test_20.txt AC 140 ms 84436 KB
test_21.txt AC 133 ms 84436 KB
test_22.txt AC 140 ms 84428 KB
test_23.txt AC 131 ms 84440 KB
test_24.txt AC 140 ms 84184 KB
test_25.txt AC 136 ms 84112 KB
test_26.txt AC 139 ms 84428 KB
test_27.txt AC 133 ms 84180 KB
test_28.txt AC 139 ms 84120 KB
test_29.txt AC 135 ms 83580 KB
test_30.txt AC 139 ms 84168 KB
test_31.txt AC 133 ms 83824 KB
test_32.txt AC 136 ms 83912 KB
test_33.txt AC 134 ms 83472 KB
test_34.txt AC 138 ms 83908 KB
test_35.txt AC 134 ms 83868 KB
test_36.txt AC 138 ms 84348 KB
test_37.txt AC 135 ms 83652 KB
test_38.txt AC 139 ms 83724 KB
test_39.txt AC 88 ms 82044 KB


2025-04-04 (Fri)
09:04:38 +00:00