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:
#W, H, x, y, r = map(int, input().split())
def main():
    a, b, c, x, y = map(int, input().split())

    min_sum = 100000 * 5000 + 100000 * 5000 + 200000 * 5000

    if a  <= c and b <= c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
                        else:
                            break
    print(min_sum)
        # if a >= c and b <= c :
        #     sum = x * c * 2
        #     if x <= y :
        #         sum = sum + ( y - x ) * b
        # else:
        #     sum = y * c * 2
        #     if x >= y :
        #         sum = sum + ( x - y ) * a

main()

    # if b > c * 2 :
    #     b_price = c
    #
    # input_array_list = []
    #
    # while True:
    #     input_array = input().split()
    #     if input_array[0] == "0" and input_array[1] == "0":
    #         break
    #     else:
    #         input_array_list.append(input_array)
    #
    # for item in input_array_list:
    #     n = int(item[0])
    #     k_sum = int(item[1])
    #
    #     count = 0
    #     for i in range(1,n + 1- 2):
    #         for j in range(i+1, n + 1 - 1):
    #             for k in range (j+1, n+ 1):
    #                 if i + j + k == k_sum :
    #                     count = count + 1
    #     print(count)

    #
    # for item in input_array_list:
    #     if item[1] == "+":
    #         print(str(int(item[0])+int(item[2])))
    #     elif item[1] =="-":
    #         print(str(int(item[0])-int(item[2])))
    #     elif item[1] == "/":
    #         print(str(int(item[0])//int(item[2])))
    #     elif item[1] == "*":
    #         print(str(int(item[0])*int(item[2])))
    #

# import sympy as sp

# input_list = []
# a,b,c = map(int, input().split())
# divisors = sp.divisors(c)
#
# count = 0
#
# for divisor in divisors:
#     if a <= divisor and divisor <= b:
#         count = count + 1
# print(count)
#
# while True:
#     pair_str = input().split()
#     pair_int = [int(s) for s in pair_str]
#     if pair_int[0] == 0 and pair_int[1] == 0 :
#         break
#     else:
#         input_list.append(pair_int)
#
# for pair_int in input_list:
#     if pair_int[0] <= pair_int[1]:
#         print("{} {}".format(pair_int[0], pair_int[1]))
#     else:
#         print("{} {}".format(pair_int[1], pair_int[0]))

#for i in range(10000):
#    print("Hello World")
#a = input().split()
#a_int = [int(s) for s in a]
#a_sorted = sorted(a_int)
#print(' '.join(map(str, a_sorted)))

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = map(int, input().split())

    min_sum = 1000000000000000000

    if a  <= c and b <= c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
                        else:
                            break
    print(min_sum)
        # if a >= c and b <= c :
        #     sum = x * c * 2
        #     if x <= y :
        #         sum = sum + ( y - x ) * b
        # else:
        #     sum = y * c * 2
        #     if x >= y :
        #         sum = sum + ( x - y ) * a

main()

Submission status: Wrong Answer

Solution code:
#W, H, x, y, r = map(int, input().split())
def main():
    a, b, c, x, y = map(int, input().split())

    min_sum = 1000000000000000000

    if a  <= c and b <= c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
    print(min_sum)
        # if a >= c and b <= c :
        #     sum = x * c * 2
        #     if x <= y :
        #         sum = sum + ( y - x ) * b
        # else:
        #     sum = y * c * 2
        #     if x >= y :
        #         sum = sum + ( x - y ) * a

main()

    # if b > c * 2 :
    #     b_price = c
    #
    # input_array_list = []
    #
    # while True:
    #     input_array = input().split()
    #     if input_array[0] == "0" and input_array[1] == "0":
    #         break
    #     else:
    #         input_array_list.append(input_array)
    #
    # for item in input_array_list:
    #     n = int(item[0])
    #     k_sum = int(item[1])
    #
    #     count = 0
    #     for i in range(1,n + 1- 2):
    #         for j in range(i+1, n + 1 - 1):
    #             for k in range (j+1, n+ 1):
    #                 if i + j + k == k_sum :
    #                     count = count + 1
    #     print(count)

    #
    # for item in input_array_list:
    #     if item[1] == "+":
    #         print(str(int(item[0])+int(item[2])))
    #     elif item[1] =="-":
    #         print(str(int(item[0])-int(item[2])))
    #     elif item[1] == "/":
    #         print(str(int(item[0])//int(item[2])))
    #     elif item[1] == "*":
    #         print(str(int(item[0])*int(item[2])))
    #

# import sympy as sp

# input_list = []
# a,b,c = map(int, input().split())
# divisors = sp.divisors(c)
#
# count = 0
#
# for divisor in divisors:
#     if a <= divisor and divisor <= b:
#         count = count + 1
# print(count)
#
# while True:
#     pair_str = input().split()
#     pair_int = [int(s) for s in pair_str]
#     if pair_int[0] == 0 and pair_int[1] == 0 :
#         break
#     else:
#         input_list.append(pair_int)
#
# for pair_int in input_list:
#     if pair_int[0] <= pair_int[1]:
#         print("{} {}".format(pair_int[0], pair_int[1]))
#     else:
#         print("{} {}".format(pair_int[1], pair_int[0]))

#for i in range(10000):
#    print("Hello World")
#a = input().split()
#a_int = [int(s) for s in a]
#a_sorted = sorted(a_int)
#print(' '.join(map(str, a_sorted)))

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = map(int, input().split())

    min_sum = 100000000000

    if a  <= c and b <= c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
    print(min_sum)
        # if a >= c and b <= c :
        #     sum = x * c * 2
        #     if x <= y :
        #         sum = sum + ( y - x ) * b
        # else:
        #     sum = y * c * 2
        #     if x >= y :
        #         sum = sum + ( x - y ) * a

main()

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = map(int, input().split())

    sum = 0

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

    print(sum)
main()

Submission status: Wrong Answer

Solution code:
#W, H, x, y, r = map(int, input().split())
def main():
    a, b, c, x, y = map(int, input().split())

    sum = 0

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

    print(sum)
main()

Submission status: Wrong Answer

Solution code:
a , b , c , x , y = map(int,input().split())
ans = 10*10

for i in range(10**8):
    ans = min(ans, a * max(x -i,0) + b * max (y - i , 0  + (2 * c * i)  ))

print(ans)

Submission status: Wrong Answer

Solution code:
a , b , c , x , y = map(int,input().split())
ans = 10*10

for i in range(10**8):
    ans = min(ans, a * max(x -i,0) + b * max ( y - i , 0 ) + (2 * c * i)  )

print(ans)

Submission status: Wrong Answer

Solution code:
a , b , c , x , y = map(int,input().split())
ans = 10*10

for i in range(10*8):
    ans = min(ans, a * max(x -i,0) + b * max ( y - i , 0 ) + (2 * c * i)  )

print(ans)

Submission status: Wrong Answer

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

k = max(x,y)
minman = 999999999999999999999
ans = 999999999999999999999999
k = k // 2
for i in range(k,-1,-1):
    now_x = x
    now_y = y
    ans = c * (i * 4)
    now_x = now_x - (i * 2)
    now_y = now_y - (i * 2)
    if now_x < 0:
        now_x = 0
    if now_y < 0:
        now_y = 0
    ans +=( now_x * a ) + ( now_y * b)
    if minman > ans:
        minman = ans
print(minman)

Submission status: Wrong Answer

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

k = max(x,y)
minman = 9999999999999

k = k // 2
for i in range(k,-1,-1):
    now_x = x
    now_y = y
    ans = c * (i * 4)
    now_x = now_x - (i * 2)
    now_y = now_y - (i * 2)
    if now_x < 0:
        now_x = 0
    if now_y < 0:
        now_y = 0
    ans +=( now_x * a ) + ( now_y * b)
    if minman > ans:
        minman = ans
print(minman)

Submission status: Wrong Answer

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

k = max(x,y)
minman = a * b * c

k = k // 2
for i in range(k,-1,-1):
    now_x = x
    now_y = y
    ans = c * (i * 4)
    now_x = now_x - (i * 2)
    now_y = now_y - (i * 2)
    if now_x < 0:
        now_x = 0
    if now_y < 0:
        now_y = 0
    ans +=( now_x * a ) + ( now_y * b)
    if minman > ans:
        minman = ans
print(minman)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

#全部Cで買うとき
a = 2*C*min(X,Y) + 2*C*(max(X,Y)-min(X,Y))
print(a)

#片方を全部Cで買うとき
if X > Y:
    b = 2*C*Y + (X-Y)*A
elif Y > X:
    b = 2*C*X + (Y-X)*B
else:
    b = a
print(b)
    
#全部AとBで買うとき
c = A*X + B*Y
print(c)

print(min(a,b,c))

Submission status: Wrong Answer

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

#全部Cで買うとき
a = 2*C*min(X,Y) + 2*C*(max(X,Y)-min(X,Y))

#片方を全部Cで買うとき
if X > Y:
    b = 2*C*Y + (X-Y)*A
elif Y > X:
    b = 2*C*X + (Y-X)*A
else:
    b = a

#全部AとBで買うとき
c = A*X + B*Y

print(min(a,b,c))

Submission status: Wrong Answer

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

max_c = X+Y
if (X+Y)%2:
  max_c += 1

min_cost = float('inf')
for c in range(0, max_c+1, 2):
  a = max(0, X - c//2)
  b = max(0, Y - c//2)
  cost = A*a + B*b + C*c
  if cost < min_cost:
    min_cost = cost
    
print(min_cost)

Submission status: Wrong Answer

Solution code:
pa,pb,pab,a,b=list(map(int,input().split()))
S1=pa*a+pb*b
S2=2*pab*max(a,b)
if S1>S2:
  print(S2)
else:
  if pa+pb>pab*2:
    print(2*pab*min(a,b)+pa*(a-min(a,b))+pb*(b-min(a,b)))
  else:
    print(S1)

Submission status: Wrong Answer

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

cost_list = []
for i in range(0, max([X, Y]) * 2 + 1, 2):
    AB_cost = C * i
    A_cost = A * (X - int(i / 2))
    B_cost = B * (Y - int(i / 2))
    if A_cost >= 0 and B_cost >= 0:
        cost = AB_cost + A_cost + B_cost
        cost_list.append(cost)

#print(cost_list)
print(min(cost_list))

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*y+a*(x-y),2*c*x))
else:
  print(min(a*x+b*y,2*c*y+b*(y-x),2*c*y))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
if A>=2*C:
  if B>=2*C:
    print(2*C*max(X,Y))
    exit()
  else:
    print(2*C*X+B*max(0,(Y-X)))
    exit()
elif B>=2*C:
  print(2*C*Y+A*max(0,(X-Y)))
  exit()
else:
  ans=A*X+B*Y
  for i in range(1,max(X,Y)):
    p=A*(X-i)+B*(Y-i)+2*C*i
    ans=min(ans,p)
  print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
class Pizza:
  def __init__(self, price, count = 0):
    self.price = price
    self.count = count
    
  def count_pay(self):
  	return self.price * self.count
  
  def add_count(self,n):
  	self.count += n
    
A, B, C, X, Y = map(int, input().split())
P_A = Pizza(A,X)
P_B = Pizza(B,Y)
P_AB = Pizza(C)

i = 0
pay_list = []
while i < max(X, Y):
  pay = P_A.count_pay() + P_B.count_pay() + P_AB.count_pay()
  pay_list.append(pay)
  P_A.add_count(-1)
  P_B.add_count(-1)
  P_AB.add_count(2)
  i += 1

print(min(pay_list))

Submission status: Wrong Answer

Solution code:
import math
A,B,C,X,Y = map(int,input().split())
a = [0,1,2,X-2,X-1,X,X-Y,X-Y+1,X-Y-1]
b = [0,1,2,Y-2,Y-1,Y,Y-X,Y-X+1,Y-X-1]
c = [0,1,2,X*2-2,X*2-1,X*2,Y*2-2,Y*2-1,Y*2]
ans = A * X + B * Y
for aa in a:
    for bb in b:
        for cc in c:
            if aa + cc * 0.5 >= X and bb + cc * 0.5 >= Y:
                mny = A * aa + B * bb + C * cc
                if mny < ans:
                    ans = mny
print(ans)

Submission status: Wrong Answer

Solution code:
import math
A,B,C,X,Y = map(int,input().split())
a = [0,1,2,X-2,X-1,X]
b = [0,1,2,Y-2,Y-1,Y]
c = [0,1,2,X*2-2,X*2-1,X*2,Y*2-2,Y*2-1,Y*2]
c.sort()
ans = A * X + B * Y
for aa in a:
    for bb in b:
        for cc in c:
            if aa + cc * 0.5 >= X and bb + cc * 0.5 >= Y:
                mny = A * aa + B * bb + C * cc
                if mny < ans:
                    ans = mny
print(ans)

Submission status: Wrong Answer

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

ans = 10**7
for i in range(max(X, Y) * 2 + 1):
    c = i
    a = X - i // 2
    if a < 0:
        a = 0
    b = Y - i // 2
    if b < 0:
        b = 0
    v = a * A + b * B + c * C
    if v < ans:
        ans = v

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 16
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 8
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 5
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=list(map(int,input().split()))
ans=0
if 2*c*max(x,y)<=a*x+b*y:
  ans+=2*c*max(x,y)
elif a+b>2*c:
  ans+=2*c*min(x,y)
  if x>y:
    ans+=a*(x-y)
  else:
    ans+=b*(y-x)
else:
  ans+=a*x+b*y
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=list(map(int,input().split()))
ans=0
if a+b>2*c:
  ans+=2*c*min(x,y)
  if x>y:
    ans+=a*(x-y)
  else:
    ans+=b*(y-x)
else:
  ans+=a*x+b*y
print(ans)

Submission status: Wrong Answer

Solution code:
##import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b,c,x,y=map(int,input().split())
if x<y:
    ans=min((a*x+b*y),2*x*c+a*(y-x),2*y*c)
    
else:
    ans=min((a*x+b*y),2*y*c+b*(x-y),2*x*c)
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
if a + b <= 2 * c:
    ans = a * x + b * y
else:
    z = min(x, y)
    ans = 2 * c * min(x, y) + a * (x - z) + b * (y - z)
print(ans)

Submission status: Wrong Answer

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

C *= 2
ans = 0

if A + B > C:
    ans += min(X, Y) * C
    n = abs(X - Y)
    ans += n * A if X > Y else n * B
else:
    ans += A*X + B*Y

print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y =map(int, input().split())
ab = 2*c
i = 1
cost = 0
while True:
    cost = i *ab
    if i <= x  or i <= y:
        break
    i += 1
cost += a *(max(0, (x-i)))
cost += b *(max(0, (y-i)))
print(cost)

Submission status: Wrong Answer

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

price=0
if X>Y:    
  N_same=Y
  flag='A'
else:
  N_same=X
  flag='B'
  
if A+B >2*C:
  price+=2*C*N_same
else:
  price+=(A+B)*N_same

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

print(price)

Submission status: Wrong Answer

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

if 2*C<A and 2*C<B:
    ans=C*(2*max(X,Y))
    print(ans)
    exit()

ans=10**10
for i in range(0,2*min(X,Y)+1,2):#ABピザを買う枚数を２枚ずらしで全探索
    tmp = A*(X-0.5*i) + B*(Y-0.5*i) + C*i
    ans=min(ans,tmp)
print(int(ans))

Submission status: Wrong Answer

Solution code:
import copy
import math

# a = get_int()
def get_int():
    return int(input())
# a = get_string()
def get_string():
    return input()
# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]
# a_list = get_string_list():
def get_string_list():
    return input().split()
# a, b = get_int_multi()
def get_int_multi():
    return map(int, input().split())
# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))
# print("{} {}".format(a, b))
# for num in range(0, a):
# a_list[idx]
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''

def main():

    a, b, c, x, y = get_int_multi()
    ans = 100000 * 5000 * 2

    for i in range(0,x+y+1):
        price = i * a
        cnt_c = max(0,(x - i) * 2)
        price += cnt_c * c
        cnt_b = max(0, y - (cnt_c // 2))
        price += cnt_b * b
        ans = min(ans, price)

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    A, B, C, X, Y = map(int, input().split())
    min_cost = C*2*max(X, Y) 
    for c in range(-1, 2*pow(10, 5)+2, 2):
        a = X-c//2
        b = Y-c//2
        if a==100000 and b==100000:
            print("ans")
        if a>=0 and b>=0:
            cost = A*a+b*B+C*c
            min_cost = min(cost, min_cost)
    print(min_cost)

Submission status: Wrong Answer

Solution code:
#関数リスト
import sys
input = sys.stdin.readline


def RD(): return input().rstrip()
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))

def main():
    A, B, C, X, Y = MI()
    if C >= (A+B) / 2:
        print(A*X+B*Y)
    else:
        temp = min(X,Y)
        print(C*temp*2+(X-temp)*A+(Y-temp)*B)
    
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if a>=c*2 and b>=c*2:
    print(c*2*max(x,y))
elif a<=c*2 and b>=c*2:
    print(c*2*y+a*x)
elif b<=c*2 and a>=c*2:
    print(c*2*x+b*y)
elif (a+b)>=c*2:
    z=min(x,y)
    x-=z
    y-=z
    print(c*2*z+a*x+b*y)
else:
    print(a*x+b*y)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ret = 5000 * (10 ** 5)
for i in range(10 ** 5 + 1):
    ret = min(ret, A * max(0, X - i) + B * max(0, Y - i) + 2 * i * C)
print(ret)

Submission status: Wrong Answer

Solution code:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

def main():
    a,b,c,x,y = map(int, input().split())
    if c<=a and c<=b:
        if x > y:
            c_cst = 2*y*c
            x = x -y
            print(a*x+c_cst)
        else:
            c_cst = 2*x*c
            y = y-x
            print(b*y+c_cst)
    elif a<c and b<c:
        print(a*x+b*y)
    elif b < c: # b<c<a
        ans = 0
        c_cst = 2*x*c
        if x >= y:
            ans = c_cst
        else:
            y_2 = y - x
            ans = c_cst+y_2*b
        ans_2 = a*x+b*y
        print(min(ans,ans_2))
    else: # a<c<b
        ans = 0
        c_cst = 2*y*c
        if y >= x:
            ans = c_cst
        else:
            x_2 = x - y
            ans = c_cst+x_2*a
        ans_2 = a*x+b*y
        print(min(ans,ans_2))




if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

if a > 2*c and b > 2*c:
    ans = 2*c*max(x, y)
elif a < c and  b < c:
    ans = a*x + b*y
else:
    ans = float('inf')
    for i in range(min(x, y)+1):
        p = 2*c*i + (x-i)*a + (y-i)*b #; print(i, p)
        ans = min(p, ans)
print(ans)

Submission status: Wrong Answer

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

if a > 2*c and b > 2*c:
    ans = 2*c*max(x, y)  
elif a + b > 2*c:
    if x < y:
        ans = 2*c*x + b*(y-x)
    else:
        ans = 2*c*y + a*(x-y)
else:
    ans = a*x + b*y

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split());print(min(c*2*min(x,y)+abs(x-y)*min(a,b,2*c),a*x+b*y))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
cost=A*X+B*Y
Z=min(X,Y)
for i in range(0,2*Z+1,2):
    cost=min(cost,C*i+A*(X-(i//2))+B*(Y-(i//2)))
print(cost)

Submission status: Wrong Answer

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

ans = min(A*X+B*Y, C*max(X, Y)*2, C*min(X,Y)*2+(max(X,Y)-min(X,Y))*A)

print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
if A+B > 2*C:
  cost = 2*C*min(X,Y)
  if X > Y:
    cost += (X-Y)*A
  else:
    cost += (Y-X)*B
else:
  cost = A*X+B*Y
print(cost)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ans = 0
if 2 * C < A + B:
    ans += min(X, Y) * 2 * C
    if X >= Y:
        ans += (X - Y) * A
    else:
        ans += (Y - X) * B
else:
    ans = X * A + Y * B
print(ans)

Submission status: Wrong Answer

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

cost = [x*a + y*b]
for i in range(max(x, y)*2+1):
    numofabpizza = i*2
    numofapizza = max(0, (x-numofabpizza))
    numofbpizza = max(0, (y-numofabpizza))
    # print(numofapizza, numofbpizza, numofabpizza)
    cost.append(numofapizza*a + numofbpizza*b + (2*numofabpizza)*c)
# print(cost)
print(min(cost))

Submission status: Wrong Answer

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

cost = [x*a + y*b]
for i in range(max(x, y)*2):
    numofabpizza = i*2
    numofapizza = max(0, (x-numofabpizza))
    numofbpizza = max(0, (y-numofabpizza))
    # print(numofapizza, numofbpizza, numofabpizza)
    cost.append(numofapizza*a + numofbpizza*b + (2*numofabpizza)*c)
# print(cost)
print(min(cost))

Submission status: Wrong Answer

Solution code:

[A,B,C,X,Y] = list(map(int,input().split()))

out=10**6
for c in range(2*(10**5)+1):
    if c%2==0:
        a = X - c//2
        b = Y - c//2
        cost = A*a + B*b + C*c

        if cost>=0 and a>=0 and b>=0:
            # print('a,b,c,cost:',a,b,c,cost)
            out=min(out,cost)
print(out)

Submission status: Wrong Answer

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


if x >= y:
    tmp1 = y*2*c + (x-y)*a
    tmp2 = c*x*2
    tmp3 = a*x + b*y
    print(min([tmp1, tmp2, tmp3]))
else:
    tmp1 = x * 2 * c + (y-x) * a
    tmp2 = c * y * 2
    tmp3 = a * x + b * y
    print(min([tmp1, tmp2, tmp3]))

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:
    if x >= y:
        tmp1 = y*2*c + (x-y)*a
        tmp2 = c*x*2
        print(min(tmp1, tmp2))
    else:
        tmp1 = x * 2 * c + (y-x) * a
        tmp2 = c * y * 2
        print(min(tmp1, tmp2))

Submission status: Wrong Answer

Solution code:
x=input().split()
x=[int(x[i]) for i in range(len(x))]
if x[0]+x[1]<=2*x[2]:
    print(x[0]*x[3]+x[1]*x[4])
else:
    if x[3]>x[4]:
        ans=x[4]*2*x[2]+(x[3]-x[4])*x[0]
        ans=min(ans,x[3]*2*x[2])
    else:
        ans=x[3]*2*x[2]+(x[4]-x[3])*x[0]
        ans=min(ans,x[4]*2*x[2])
    print(ans)

Submission status: Wrong Answer

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

if x==y:
    each = 0
elif x>y:
    each = a*(x-y)
else:
    each = b*(y-x)

print(min(x, y)*2*c+each)

Submission status: Wrong Answer

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

count = a * x + b * y
for i in range(10 ** 5):
  num = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if(count > num):
    count = num

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count = float("inf")
for i in range(10 ** 5):
  num = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if(count > num):
    count = num

print(count)

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)
    exit()
if (X>Y and A>=C*2) or (Y>X and B>=C*2):
    print(C*2*max(X,Y))
    exit()
price = min(X,Y)*C*2
if X >= Y:
    print(price+(X-Y)*A)
else:
    print(price*(Y-X)*B)

Submission status: Wrong Answer

Solution code:
import math

def main():
    A,B,C,X,Y = [int(x) for x in input().split()]
    ans = 0
    if A>C*2 or B>C*2:
        # print('a')
        ans = C*max(X,Y)*2
    elif A+B <= C*2:
        # print('b')
        ans = A*X + B*Y
    else:
        if X<=Y:
            # print('c')
            ans = C*X*2 + B*(Y-X)
        elif X>Y:
            # print('d')
            ans = C*Y*2 + A*(X-Y)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

def main():
    A,B,C,X,Y = [int(x) for x in input().split()]
    ans = 0
    if A>=C*2 or B>=C*2:
        # print('a')
        ans = C*max(X,Y)*2
    elif A+B <= C*2:
        # print('b')
        ans = A*X + B*Y
    else:
        if X<=Y:
            # print('c')
            ans = C*X*2 + B*(Y-X)
        elif X>Y:
            # print('d')
            ans = C*Y*2 + A*(X-Y)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

def main():
    A,B,C,X,Y = [int(x) for x in input().split()]
    ans = 0
    if A>C*2 and B>C*2:
        # print('a')
        ans = C*max(X,Y)*2
    elif A+B <= C*2:
        # print('b')
        ans = A*X + B*Y
    else:
        if X<=Y:
            # print('c')
            ans = C*X*2 + B*(Y-X)
        elif X>Y:
            # print('d')
            ans = C*Y*2 + A*(X-Y)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math

def main():
    A,B,C,X,Y = [int(x) for x in input().split()]
    ans = 0
    if A>C*2 and B>C*2:
        # print('a')
        ans = C*max(X,Y)*2
    elif A+B < C*2:
        # print('b')
        ans = A*X + B*Y
    else:
        if X<=Y:
            # print('c')
            ans = C*X*2 + B*(Y-X)
        elif X>Y:
            # print('d')
            ans = C*Y*2 + A*(X-Y)
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#095_C
a, b, c, x, y = map(int, input().split())

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

Submission status: Wrong Answer

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

if a>= c*2 and b >= c*2:
    print(max(x,y)*c*2)

elif a>= c*2 and x >=y :
    print(x*c*2)

elif b >= c*2 and y<=x:
    print(y*c*2)

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

Submission status: Wrong Answer

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

if a>= c*2 and b >= c*2:
    print(max(x,y)*c*2)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
p = 0

if x > y:
    p += (x - y) * a
    x = y
if x < y:
    p += (y - x) * b
    y = x
if x > 0:
    n = x * 2 * c
    m = x * a + y * b
    p += min(n,m)

print(p)