Problem:


Score : 300 points

Problem Statement

"Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.

Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Constraints

1 ≤ A, B, C ≤ 5000

1 ≤ X, Y ≤ 10^5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B C X Y

Output

Print the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.

Sample Input 1

1500 2000 1600 3 2

Sample Output 1

7900

It is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.

Sample Input 2

1500 2000 1900 3 2

Sample Output 2

8500

It is optimal to directly buy three A-pizzas and two B-pizzas.

Sample Input 3

1500 2000 500 90000 100000

Sample Output 3

100000000

It is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.



Sample input:
1500 2000 1600 3 2


Sample output:
7900

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))

bo = True
if a[0]+a[1] < a[2]*2:
    bo = False
if a[3] > a[4]:
    if bo == True:
        price = a[2]*a[4]*2 + (a[3]-a[4])*a[0]
    else:
        price = a[0]*a[3]+a[1]*a[4]
else:
    if bo == True:
        price = a[2]*a[3]*2 + (a[4]-a[3])*a[1]
    else:
        price = a[0]*a[3]+a[1]*a[4]
print(price)

Submission status: Wrong Answer

Solution code:
import random

#--------ピ　ザ　群　最　適　化------------------------------

#評価関数: 　双対問題
def criterion(x, y):
    z=xo*x+yo*y

    if x>a or y>b or x+y>2*c or x<0 or y<0:
        z=-z
    
    return z

#粒子の位置の更新を行う関数
def update_position(x, y, vx, vy):
 
    new_x = x + vx
    new_y = y + vy

    return new_x, new_y

#粒子の速度の更新を行う関数
def update_velocity(x, y, vx, vy, p, g, w=1, ro_max=0.5,v_max=10):
    #パラメーターroはランダムに与える
    ro1 =random.uniform(0, ro_max)
    ro2 =random.uniform(0, ro_max)
    #粒子速度の更新を行う
    new_vx = int((w * vx + ro1 * (p["x"] - x) + ro2 * (g["x"] - x)))
    new_vy = int((w * vy + ro1 * (p["y"] - y) + ro2 * (g["y"] - y)))
    if abs(new_vx)>v_max:
        new_vx=int(v_max*new_vx/abs(new_vx))
    if abs(new_vy)>v_max:
        new_vy=int(v_max*new_vy/abs(new_vy))

    #print(new_vx, new_vy)
    return new_vx, new_vy
    
def main():
    N = 2000  #粒子の数
    x_min, x_max = 0, a
    y_min, y_max = 0, b
    #粒子位置, 速度, パーソナルベスト, グローバルベストの初期化を行う
    ps = [{"x": random.randint(x_min, x_max), 
        "y": random.randint(y_min, y_max)} for i in range(N)]
    vs = [{"x": 0, "y": 0} for i in range(N)]

    personal_best_positions = list(ps)
    personal_best_scores = [criterion(p["x"], p["y"]) for p in ps]

    best_particle = personal_best_scores.index(max(personal_best_scores))
    global_best_position = personal_best_positions[best_particle]

    T = 100  #制限時間(ループの回数)
    for t in range(T):
        for n in range(N):
            x, y = ps[n]["x"], ps[n]["y"]
            vx, vy = vs[n]["x"], vs[n]["y"]
            p = personal_best_positions[n]
            #粒子の位置の更新を行う
            new_x, new_y = update_position(x, y, vx, vy)
            ps[n] = {"x": new_x, "y": new_y}
            #粒子の速度の更新を行う
            new_vx, new_vy = update_velocity(
                new_x, new_y, vx, vy, p, global_best_position)
            vs[n] = {"x": new_vx, "y": new_vy}
            #評価値を求め, パーソナルベストの更新を行う
            score = criterion(new_x, new_y)
            if score > personal_best_scores[n]:
                personal_best_scores[n] = score
                personal_best_positions[n] = {"x": new_x, "y": new_y}
        #グローバルベストの更新を行う
        best_particle = personal_best_scores.index(max(personal_best_scores))
        global_best_position = personal_best_positions[best_particle]
#        print(max(personal_best_scores), global_best_position["x"], global_best_position["y"])

    #最適解
    return max(personal_best_scores), global_best_position["x"], global_best_position["y"]


#--------------------------------------------------------------

a, b, c, xo, yo = [int(i) for i in input().split()]
#a, b, c, xo, yo = 1500, 2000, 500, 90000, 100000
best=-100000000
xx=0
yy=0
for i in range(2):
    kouho_best, kouho_x, kouho_y=main()
    if best<kouho_best:
        best=kouho_best
        xx=kouho_x
        yy=kouho_y

print(best)

Submission status: Wrong Answer

Solution code:
S = map(int, raw_input().split())
A = S[0]
B = S[1]
C = S[2]
X = S[3]
Y = S[4]

total = 0

if X > Y:
    A = S[1]
    B = S[0]
    X = S[4]
    Y = S[3]

if A > C * 2:
    total += C * 2 * X
    Y -= X
    X = 0

if B > C * 2:
    total += C * 2 * Y
    Y = 0

if A + B > C * 2:
    total += C * 2 * X
    Y -= X
    X = 0

total += A * X + B * Y

print(total)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())

ans1=max(X,Y)*C*2
ans2=X*A+Y*B
if X>Y:
  if Y%2==0:
    ans3=C*Y*2+(X-Y)*A
  else:
    ans3=C*2*(Y-1)+(X-Y+1)*A+B
else:
  if X%2==0:
    ans3=C*X*2+(Y-X)*B
  else:
    ans3=C*2*(X-1)+(Y-X+1)*B+A

print(min(ans1,ans2,ans3))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())

total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)
        
elif (C2>=A and C2<=B):
    total_price=C2*min(X,Y)
    total_price=total_price+B*(Y-X)      
    print(total_price)
    
elif (C2<=A and C2>=B) :
    total_price=C2*min(X,Y)
    total_price=total_price+A*(X-Y)      
    print(total_price)

elif C2<=(A+B):  #C2<=(A+B): 
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())

total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)

elif C2<=A and C2>=B:
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
elif (C2>=A and C2<=B) or (C2<=A and C2>=B) :
    total_price=C2*min(X,Y)
    total_price=total_price+min(A,B)*(max(X,Y)-min(X,Y))        
    

elif C2<(A+B):  #C2<=(A+B): 
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())

total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)

elif C2<=A and C2>=B:
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
elif (C2>=A and C2<=B ) or (C2<=A and C2>=B ) :
    total_price=C2*min(X,Y)
    total_price=total_price+min(A,B)*(max(X,Y)-min(X,Y))        
    

elif C2<=(A+B):  #C2<=(A+B): 
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())

if X>Y:
    print(min( A*X+B*Y , 2*C*X , 2*C*Y+A*(X-Y)))
else:
    print(min( A*X+B*Y , 2*C*Y , 2*C*Y+A*(Y-X)))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())

total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)

elif C2<=A and C2>=B:
    total_price=C2*X
    

elif C2<=A or C2<=B:  #C2<=(A+B): 
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())

total_price=0
C2=C*2

if C2<=A and C2<=B:
    total_price=C2*max(X,Y)

elif C2<=(A+B):
    if X>=Y:
        total_price=C2*Y
        X=X-Y
        Y=0
        total_price=total_price+A*X
    else:
        total_price=C2*X
        X=0
        Y=Y-X
        total_price=total_price+B*Y
        
else:
    total_price=A*X+B*Y
print(total_price)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = list(map(int, input().split()))
pri = 0

if A + B <= 2 * C:
    pri = A * X + B * Y
else:
    while min(X, Y) >= 1:
        pri += C * 2
        X -= 1
        Y -= 1
    if A * X + B * Y >= 2 * C:
        pri += 2 * C
    else:
        pri += A * X + B * Y

print(pri)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = (int(i) for i in input().split()) 

def result(min, max):
    if A > 2 * C :
        print(min * 2 * C + (max - min) * C * 2)
    else:
        print(min * 2 * C + (max - min) * A)

if A + B > 2 * C :
    if X > Y:
        result(Y, X)
    else:
        result(X, Y)
else:
    print(A * X + B * Y)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = (int(i) for i in input().split())  

min = min(X, Y)
max = max(X, Y)

if A + B > 2 * C :
    if A > 2 * C :
        print(min * 2 * C + (max-min) * C * 2)
    else:
        print(min * 2 * C + (max-min) * A)
else:
    print(A * X + B * Y)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = list(map(int, input().split()))

ans = float('infinity')
for i in range(max(X, Y)):
    ans = min((X - i) * A + (Y - i) * B + i * C * 2, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
	a,b,c,x,y = map(int, input().split())

	if x==y:
		p = min(x*a+y*b, 2*x*c)
	elif x>y:
		p = min(x*a+y*b, 2*x*c, 2*y*c+(x-y)*a)
	else:
		p = min(x*a+y*b, 2*y*c, 2*x*c+(y-x)*a)

	print(p)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = (int(i) for i in input().split()) 

ans = 5000 * 100000

for i in range(200001):
    tmp = i * c
    xx = int( x - i/2 + 0.5 )
    yy = int( y - i/2 + 0.5 )

    tmp += (xx > 0) * xx * a
    tmp += (yy > 0) * yy * b 

    if tmp < ans:
        ans = tmp

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
A, B, C, X, Y = list(map(int,input().strip().split(' ')))
V1 = [A, B, C, C]
V2 =np.array([A-C, B-C, C-A, C-B])
N = np.array([X, Y, 2*X, 2*Y])
N2 = np.array([Y, X, max(Y-X,0), max(X-Y,0)])
V3 = np.array([min(B,C*2),min(A,C*2),min(B,C*2),min(A,C*2)])
minidx=np.argmin(V2)
print((N[minidx])*V1[minidx]+N2[minidx]*V3[minidx])

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
def price(num_c):
    x, y = max(0, X-num_c//2), max(0, Y-num_c//2)
    return x*A + y*B + num_c * C

lo = 0
hi = max(X, Y) * 2-1
ans = min(price(lo), price(hi+1))
while hi - lo > 1:
    mid = (hi+lo)//2
    result1 = price(mid)
    result2 = price(mid+1)
    ans = min(ans, result1, result2)
    if result1 - result2 > 0:
        lo = mid
    elif result1 - result2 < 0:
        hi = mid
    else:
        print(ans)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
A, B, C, X, Y = list(map(int,input().strip().split(' ')))
V1 = [A, B, C, C]
V2 =np.array([A-C, B-C, C-A, C-B])
N = np.array([X, Y, 2*X, 2*Y])
N2 = np.array([Y, X, max(Y-X,0), max(X-Y,0)])
V3 = np.array([min(B,C*2),min(A,2*C),min(B,C*2),min(A,C*2)])
minidx=np.argmin(V2)
print((N[minidx])*V1[minidx]+N2[minidx]*V3[minidx])

Submission status: Wrong Answer

Solution code:
def solve(a, b, c, x, y):
    flag = None
    if x < y:
        flag = True
    else:
        flag = False
    if c < (a / 2) and c < (b / 2):
        return c * max(x, y) * 2
    if c < (a / 2):
        return ((y - x) * b + x * c * 2)
    if c < (b / 2):
        return ((x - y) * a + y * c * 2)
    c_many = min(x, y)
    c_total = c * c_many * 2
    return min([
        (y - c_many) * b + c_total if flag else (x - c_many) * a + c_total, 
        a * x + b * y,
    ])
   
if __name__ == '__main__':
    a, b, c, x, y = map(lambda x: int(x), input().split())

    print(solve(a, b, c, x, y))

Submission status: Wrong Answer

Solution code:
def solve(a, b, c, x, y):
    flag = None
    if x < y:
        flag = True
    else:
        flag = False
    if c < (a / 2) and c < (b / 2):
        return c * max(x, y) * 2
    if c < (a / 2):
        return ((y - x) * b + x * c * 2)
    if c < (b / 2):
        return ((x - y) * a + y * c * 2)
    c_many = min(x, y)
    c_total = c * c_many * 2
    return min([
        (y - c_many) * b + c_total if flag else (x - c_many) * a + c_total, 
        a * x + b * y,
        max(x, y) * 2 * c,
    ])
   
if __name__ == '__main__':
    a, b, c, x, y = map(lambda x: int(x), input().split())

    print(solve(a, b, c, x, y))

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())

H = []
for i in [n for n in range(10 ** 5) if n <= X or n <= Y]:
    p = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B
    H.append(p)

print(min(H))

Submission status: Wrong Answer

Solution code:
import numpy as np
A, B, C, X, Y = list(map(int,input().strip().split(' ')))

tmp = np.array([A,B])-np.array([C, C])
if abs(tmp[0]) >= abs(tmp[1]):
        if tmp[0] >= 0 and tmp[0] >= 0:
                print(2*C*X + C*(max(Y-X,0)))
        if tmp[0] >= 0 and tmp[0] < 0:
                print(2*C*X + A*(max(Y-X,0)))
        if tmp[0] < 0 and tmp[0] >= 0:
                print(A*X + C*2*Y)
        if tmp[0] < 0 and tmp[0] < 0:
                print(A*X + B*Y)
if abs(tmp[0]) < abs(tmp[1]):
        if tmp[0] >= 0 and tmp[0] >= 0:
                print(B*Y + C*2*X)
        if tmp[0] >= 0 and tmp[0] < 0:
                print(B*Y + A*X)
        if tmp[0] < 0 and tmp[0] >= 0:
                print(2*C*Y + C*(max(X-Y,0)))
        if tmp[0] < 0 and tmp[0] < 0:
                print(2*C*Y + A*(max(X-Y,0)))

Submission status: Wrong Answer

Solution code:
def main():
    l=input().split()
    a=int(l[0])
    b=int(l[1])
    c=int(l[2])
    x=int(l[3])
    y=int(l[4])
    if x>y:
        x, y=y, x
        a, b=b, a
    t=(x//2)*2
    if (a+b)<c*2:
        res=(a+b)*t
    else:
        res=c*t*2
    x-=t
    y-=t
    res+=min(a*x+b*y, c*2*y)
    print(res)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = [int(i) for i in input().split()]

if a + b // 2 < c:
    c = a + b // 2

n = a * x + b * y
m = c * max(x, y) * 2

v = 0

if x > y:
    v = c * y * 2 + a * (x-y)
else:
    v = c * x * 2+ a * (y-x)

print(min(n, v, m))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
a,b,c,x,y = [int(i) for i in input().split()]

z = 0
min_price = a * x + b * y

while(True):
    if (x - z <= 0) and (y - z <= 0):
        break
    elif (x - z <= 0):
        sum_price = (y - z) * b + 2 * z * c
    elif (y - z <= 0):
        sum_price = (x - z) * a + 2 * z * c
    else:
        sum_price = (x - z) * a + (y - z) * b + 2 * z * c

    if sum_price < min_price:
        min_price = sum_price
    z += 1
    
print(min_price)

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = (int(i) for i in input().split())
    total=0
    total_half=0
    z=0
    if ( a+b < c):
        ab1 = a + b
    else:
        ab1 = 2*c
    if (x<y):
        total+=x*ab1
        total += (y-x)*b
        total_half += y*ab1
    else:
        total+=y*ab1
        total += (x-y)*a
        total_half += x*ab1
    if (total < total_half):
        print(total)
    else:
        print(total_half)
main()

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
def price(num_c):
    x, y = max(0, X-num_c//2), max(0, Y-num_c//2)
    return x*A + y*B + num_c * C

lo = 0
hi = max(X, Y) * 2
ans = min(price(lo), price(hi))
while hi - lo > 1:
    mid = (hi+lo)//2
    result1 = price(mid)
    result2 = price(mid+1)
    ans = min(ans, result1, result2)
    if result1 - result2 > 0:
        lo = mid
    elif result1 - result2 < 0:
        hi = mid
    else:
        print(ans)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
def price(num_c):
    x, y = max(0, X-num_c//2), max(0, Y-num_c//2)
    return x*A + y*B + num_c * C

lo = 0
hi = max(X, Y) * 2
ans = min(price(lo), price(hi))
while hi - lo > 1:
    mid = (hi+lo)//2
    result1 = price(mid)
    result2 = price(mid+1)
    ans = min(ans, result1, result2)
    if result1 - result2 > 0:
        lo = mid
    elif result1 - result2 < 0:
        hi = mid
    else:
        print("hoge")
        print(ans)
        exit()

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

a, b, c, x, y = map(int,input().split())

sum1 = 0
sum2 = 0

#iの場合
if x < y:
 sum1 = a*x + b*x
 yi = y - x
 sum1 += b*yi
else:
 sum1 = a*y + b*y
 xi = x - y
 sum1 += a*xi

#iiの場合
if x < y:
 sum2 = c*x*2
 yii = y - x
 sum2 += b*yii
else:
 sum2 = c*y*2
 xii = x - y
 sum2 += a*xii

if sum1 < sum2:
 print(sum1)
else:
 print(sum2)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = tuple(map(lambda i: int(i), input().split()))


# a + b < c * 2 #=> 個別に買うよりセットで買った方が安上がり
# a,b < c * 2 #=> 個別に買った方がセットで買うより安上がり


if a + b > c * 2:
    if a > c*2 and b > c*2:
        print(c*y*2 if x < y else c*x*2)
    elif a > c*2:
        if b < c * 2:
            print(c*x*2 + b*(y-x) if x < y else c*(x+y))
        else:
            print(c*y*2 if x < y else c*x*2)
    elif b > c*2:
        if a < c * 2:
            print(c*(x+y) if x < y else c*y*2 + a*(x-y))
        else:
            print(c*y*2 if x < y else c*x*2)
    else:
        num_c = (x if x < y else y) * 2
        print((b*(y-x) if x < y else a*(x-y)) + c*num_c)
else:
    print(a*x + b*y)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
C2 = C//2
if C*2 <= min(A,B):
  print(max(X,Y)*C*2)
elif C*2 >= A+B:
  if C*2 >= A and C*2 >= B:
    print(A*X+B*Y)
    print("C")
  else:
    if max(A,B) ==A:
      out = X*C*2
      if Y-X >=0:
        print(out+B*(Y-X))
    else:
      out = Y*C*2
      if X-Y >=0:
        print(out+A*(X-Y))
else:
  out = min(X,Y)*C*2
  if max(X,Y) == X:
    out += A*(X-Y)
  else:
    out += B*(Y-X)
  print(out)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = [int(i) for i in input().split()]

if a + b // 2 < c:
    c = a + b // 2

n = a * x + b * y
m = c * max(x, y) * 2

v = 0

if a <= c and b <= c:
    v = n
elif a >= c and b >= c:
    v = m
elif a <= c:
    if x >= y:
        v = c*2*y + min(c*(x-y)*2, a*(x-y))
    else:
        v = c*2*x + b*(y-x)
else:
    if x <= y:
        v = c*2*x + min(c*(y-x)*2, b*(y-x))
    else:
        v = c*2*y + a*(x-y)

print(min(n, v, m))

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = list(map(int, input().split()))

price_min = float('inf')

for ib in range(Y+1):
    price_min_b = float('inf')
    for ia in range(X+1):
        ic = max(X-ia, Y-ib) * 2
        price = A*ia+B*ib+C*ic
        print(ia, ib, ic, price)
        if price < price_min_b:
            price_min_b = price
        elif price > price_min_b:
            break
    if price_min_b < price_min:
        price_min = price_min_b
    elif price_min_b > price_min:
        break

print(price_min)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
if a + b < c * 2:
    print(a*x+b*y)
else:
    all_money = c * max([x, y]) * 2
    t=min([x,y])*c*2
    aa=abs(x-y)
    a_big_money = t + a * aa
    b_big_money = t + b * aa
    print(min([all_money,min(a_big_money,b_big_money)]))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int, input().split()))

average = int((A+B)/2)
total = 0
sub = 0
small = 0
deff = 0

if X>=Y:
    sub = 2*X*C
elif X<Y:
    sub = 2*Y*C

if X>=Y:
    small = Y
    deff = X-Y
    total += deff*A
elif X<Y:
    small = X
    deff = Y-X
    total += deff*B

if average >= C:
    total += small*C*2
elif average < C:
    total += small*average*2

if total >= sub:
    print(sub)
elif total<sub:
    print(total)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = list(map(int, input().split()))

price_min = float('inf')

for ib in range(X+1):
    price_min_a = float('inf')
    for ia in range(Y+1):
        ic = max(X-ia, Y-ib) * 2
        price = A*ia+B*ib+C*ic
        # print(ia, ib, ic, price)
        if price < price_min_a:
            price_min_a = price
        elif price > price_min_a:
            break
    if price_min_a < price_min:
        price_min = price_min_a
    elif price_min_a > price_min:
        break

print(price_min)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = tuple(map(lambda i: int(i), input().split()))


# a + b < c * 2 #=> 個別に買うよりセットで買った方が安上がり
# a,b < c * 2 #=> 個別に買った方がセットで買うより安上がり

if a + b > c * 2:
    if a > c*2 and b > c*2:
        print(c*y*2 if x < y else c*x*2)
    elif a > c*2:
        if b < c * 2:
            print(c*x*2 + b*(y-x) if x < y else c*(x+y))
        else:
            print(c*y*2 if x < y else c*x*2)
    elif b > c*2:
        if a < c * 2:
            print(c*(x+y) if x < y else c*y*2 - a*(x-y))
        else:
            print(c*y*2 if x < y else c*x*2)
    else:
        num_c = (x if x < y else y) * 2
        print((b*(y-x) if x < y else a*(x-y)) + c*num_c)
else:
    print(a*x + b*y)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = tuple(map(lambda i: int(i), input().split()))


# a + b < c * 2 #=>

if a + b > c * 2:
    if a > c and b > c:
        print(c*y*2 if x < y else c*x*2)
    elif a > c:
        if b < c * 2:
            print(c*x*2 + b*(y-x) if x < y else c*(x+y))
        else:
            print(c*y*2 if x < y else c*x*2)
    elif b > c:
        if a < c * 2:
            print(c*(x+y) if x < y else c*y*2 - a*(x-y))
        else:
            print(c*y*2 if x < y else c*x*2)
    else:
        num_c = (x if x < y else y) * 2
        print((b*(y-x) if x < y else a*(x-y)) + c*num_c)
else:
    print(a*x + b*y)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int, input().split()))

average = int((A+B)/2)
total = 0
sub = 0
small = 0
deff = 0

if X>=Y:
    sub = 2*X*C
else:
    sub = 2*Y*C
    
if X>=Y:
    small = Y
    deff = X-Y
    total += deff*A
else:
    small = X
    deff = Y-X
    total += deff*B

if average >= C:
    total += small*C*2
elif average < C:
    total += small*average*2

if total >= sub:
    print(sub)
else:
    print(total)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
if a + b < c * 2:
    print(a*x+b*y)
else:
    all_money = c * max([x, y]) * 2
    a_big_money = c*min([x,y])*2+a*abs(x-y)
    b_big_money = c * min([x, y])*2 + b * abs(x - y)

    print(min([all_money,min(a_big_money,b_big_money)]))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int, input().split()))

average = int((A+B)/2)
total = 0
sub = 0
small = 0
deff = 0

if X>=Y:
    sub = 2*X*C
else:
    sub = 2*Y*C
print(sub)
if X>=Y:
    small = Y
    deff = X-Y
    total += deff*A
else:
    small = X
    deff = Y-X
    total += deff*B

if average >= C:
    total += small*C*2
elif average < C:
    total += small*average*2

if total >= sub:
    print(sub)
else:
    print(total)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=input().split()
a=int(A)
b=int(B)
c=int(C)
x=int(X)
y=int(Y)

p=list()
p.append(a);p.append(b);p.append(c)
p.sort()
if p[0]==c:
	T=max(x,y)*2*c
	print(T)
else:
	mx=max(x,y)
	if mx==x:
		ax=a
	else:
		ax=b
	mi=min(x,y)
	if mi==x:
		ai=a
	else:
		ai=b

	t1=mx*2*c
	t2=mi*2*c+(mx-mi)*ax
	t3=mx*ax+mi*ai
	t4=a*x+y*2*c
	t5=b*y+x*2*c

	T=min(t1,t2,t3,t4,t5)
	print(T)

Submission status: Wrong Answer

Solution code:
import math

(a, b, c, x, y) = map(int, input().split())

answer = 0

z1 = min(x, y)
z2 = max(x, y)

if a * x + b * y > c * z2 * 2:
    answer = c * z2 *2
elif a * z1 + b * z1 > c * z1 * 2:
    answer += c * z1 * 2 
    answer += a * (x - z1)
    answer += b * (y - z1)
else:
    answer += a * x + b * y

print(str(answer))

Submission status: Wrong Answer

Solution code:
a = input().split()
money = 0
pizza = int(a[3])
pizzb = int(a[4])

if int(a[2])>int(a[0]) or int(a[2])>int(a[1]):
  
  if pizza<pizzb:
    while pizza<pizzb:
      money += int(a[1])
      pizzb -= 1
  elif pizza > pizzb:
    while pizza > pizzb:
      money += int(a[0])
      pizza -= 1

  if int(a[0])+int(a[1]) < int(a[2])*2:
    while pizza > 0:
      money += int(a[0])
      money += int(a[1])
      pizza -= 1
  elif int(a[0])+int(a[1]) > int(a[2])*2:
    while pizza > 0:
      money += int(a[2])*2
      pizza -= 1
      
else:
  m = max(pizza, pizzb)
  money = m*2*int(a[2])
  
print(money)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
pa = A * X
pb = B * Y
pab = pa + pb
if C == min(A, B, C):
    price = C * max(X, Y) * 2
    print(price)
elif (A + B) / 2 == C:
    pc = C * max(X, Y) * 2
    if pab < pc:
        print(pab)
    else:
        print(pc)
elif (A + B) / 2 < C:
    price = pab
    print(price)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
fx = x
fy = y
fl = 0
val = int(0)
fmin = min(x,y)
if a>2*c:
  x = 0
  y = y - fx
  val += 2*c*fx
  fl += 1
if b>2*c:
  if fl == 1:
    val += 2*c*y
    y = 0
  else:
    val += 2*c*y
    x = x -y
    y = 0 
nx = x
ny = y
if a+b>2*c:
  x = x - min(nx,ny)
  y = y - min(nx,ny)
  val += 2*c*min(nx,ny)
print(val+a*x+b*y)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
pa = A * X
pb = B * Y
pab = pa + pb
price = C * max(X, Y) * 2
print(price)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
C2 = C//2
if C*2 <= min(A,B):
  print(max(X,Y)*C*2)
elif C*2 >= A + B:
  print(A*X+B*Y)
else:
  out = min(X,Y)*C*2
  if max(X,Y) == X:
    out += A*(X-Y)
  else:
    out += B*(Y-X)
  print(out)

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
A = l[0]
B = l[1]
C = l[2]
X = l[3]
Y = l[4]
total = 0

if A + B > C * 2:
	if X > Y:
		total = (X-Y)*A + 2*Y*C
	else:
		total = (Y-X)*B + 2*X*C
else:
	total = X * A + Y * B

print(total)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
pa = A * X
pb = B * Y
pab = pa + pb
print(pab)

Submission status: Wrong Answer

Solution code:
t = [int(i) for i in input().split()]
n=min(t[3],t[4])
f=max(t[3],t[4])

if t[3]>t[4]:
    c=t[0]
else:
    c=t[1]
    
if t[2]<c/2:
    print(t[2]*f*2)
elif (t[0]*t[3]+t[1]*t[4])>(t[2]*n*2+(f-n)*c):
    print(t[2]*n*2+(f-n)*c)
elif (t[0]*t[3]+t[1]*t[4])<(t[2]*n*2+(f-n)*c):
    print(t[0]*t[3]+t[1]*t[4])

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
c_p = 2*c*min(x,y)
if x==y and (a+b)>c*2:
    print(c_p)

else:
    if x > y:
        price = min(c_p + (x-y)*a, c_p+(x-y)*c*2, a*x+b*y)
        print(price)
    elif x < y:
        price = min(c_p + (y-x) * b, c_p+(y-x)*c*2, a*x+b*y)
        print(price)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
pa = A * X
pb = B * Y
pab = pa + pb
if C == min(A, B, C):
    price = C * max(X, Y) * 2
    print(price)
elif (A + B) / 2 == C:
    pc = C * max(X, Y) * 2
    if pab < pc:
        print(pab)
    else:
        print(pc)
elif (A + B) / 2 < C:
    price = pab
    print(price)
else:
    price = C * min(X, Y) * 2
    if X > Y:
        if A > C * 2:
            price = C * max(X, Y) * 2
        else:
            n = X - Y
            price += A * n
    else:
        if B > C * 2:
            price = C * max(X, Y) * 2
        else:
            n = Y - X
            price += B * n
    print(price)

Submission status: Wrong Answer

Solution code:
t = [int(i) for i in input().split()]
n=min(t[3],t[4])
f=max(t[3],t[4])-n

if t[3]>t[4]:
    c=t[0]
else:
    c=t[1]
    
if (t[0]*t[3]+t[1]*t[4])>(t[2]*n*2+f*c):
    print(t[2]*n*2+f*c)
elif (t[0]*t[3]+t[1]*t[4])<(t[2]*n*2+f*c):
    print(t[0]*t[3]+t[1]*t[4])

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
money = 0
if A>C and B>C:
    money = C*max([X,Y])*2
#    money = price[[X,Y].index(max([X,Y]))]*max([X,Y])
elif A+B>2*C:
    money += C*min(X,Y)*2#A,Bのピザがそれぞれmin(X,Y)個できる
    if X>Y:
        money += (X-Y)*A
    else:
        money += (Y-X)*B
else:
    money += A*X+B*Y
print(money)

Submission status: Wrong Answer

Solution code:
def main():
    A, B, C, X, Y = (int(i) for i in input().split())
    if(A + B) <= C *2:
        print(A * X + B * Y)

    else:
        value = 0
#        if(min(X, Y) % 2 == 0):
        value = min(X, Y) * C * 2
        if (X - Y) >0:
            min_value = min(int(X - Y)*A, abs(X-Y)*C*2)
        else:
            min_value = min(int(Y - X)*A, abs(X-Y)*C*2)
        print(value + min_value)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    A, B, C, X, Y = (int(i) for i in input().split())
    if(A + B) <= C *2:
        print(A * X + B * Y)

    else:
        value = 0
        if(min(X, Y) % 2 == 0):
            value = min(X, Y) * C * 2
            if (X - Y) >0:
                min_value = min(int(X - Y)*A, abs(X-Y)*C*2)
            else:
                min_value = min(int(Y - X)*A, abs(X-Y)*C*2)
            print(value + min_value)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = tuple(map(lambda i: int(i), input().split()))

if a + b > c * 2:
    if a > c or b > c:
        print(c*y*2 if x<y else c*x*2)
    else:
        num_c = (x if x < y else y) * 2
        print((b*(y-x) if x < y else a*(x-y)) + c*num_c)
else:
    print(a*x + b*y)

Submission status: Wrong Answer

Solution code:
da = list(map(int,input().split()))
oka = 0
p = 0
l = 0
k = 0
if da[3] <= da[4]:
  oka = da[3]
  p = da[4]-da[3]
  l = 1
  k = 0
elif da[4] <= da[3]:
  oka = da[4]
  p = da[3]-da[4]
  l = 0
  k = 1
if (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[k]*p):
  if da[3] <= da[4]:
    print(da[2]*da[4]*2)
  else:
    print(da[2]*da[3]*2)
elif (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[l]*p):
  if da[3] <= da[4]:
    print(da[2]*da[3]*2 + da[1]*(da[4]-da[3]))
  else:
    print(da[2]*da[4]*2 + da[0]*(da[3]-da[4]))
else:
  print(da[0] * da[3] + da[1] * da[4])

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
pa = A * X
pb = B * Y
pab = pa + pb
if C == min(A, B, C):
    price = C * max(X, Y) * 2
    print(price)
elif (A + B) / 2 == C:
    pc = C * max(X, Y) * 2
    if pab < pc:
        print(pab)
    else:
        print(pc)
elif (A + B) / 2 < C:
    price = pab
    print(price)
elif max(A, B) > C * 2:
    price = C * max(X, Y) * 2
    print(price)
else:
    price = C * min(X, Y) * 2
    if X > Y:
        n = X - Y
        price += A * n
    else:
        n = Y - X
        price += B * n
    print(price)