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,B,C,X,Y=map(int,input().split())
result=0
if A+B>=C*2:
  min_pizza=min(X,Y)
  min_pizza//2*2
  X-=min_pizza
  Y-=min_pizza
  result+=C*2*min_pizza
for i,j in zip((A,B),(X,Y)):
  if i>=C*2:
    result+=C*2*(max(0,j-2))
  else:
    result+=A*(max(0,j-2))
X-=max(0,X-2)
Y-=max(0,Y-2)
cnd=[C*2*2]
for i in range(3):
  for j in range(3):
    if X<=i and Y<=j:
      cnd.append(A*i+B*j)
result+=min(cnd)
print(result)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
result=0
if A+B>=C*2:
  min_pizza=min(X,Y)
  min_pizza//2*2
  X-=min_pizza
  Y-=min_pizza
  result+=C*2*min_pizza
if A>=C:
  result+=C*2*(max(0,X-2))
else:
  result+=A*(max(0,X-2))
X-=max(0,X-2)
if B>=C:
  result+=C*2*(max(0,Y-2))
else:
  result+=B*(max(0,Y-2))
Y-=max(0,Y-2)
cnd=[C*2*2]
for i in range(3):
  for j in range(3):
    if X<=i and Y<=j:
      cnd.append(A*i+B*j)
result+=min(cnd)
print(result)

Submission status: Wrong Answer

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

INF = float("inf")
b = 0
for a in range(X + 1):
    sum = A * a
    ab_a = (X - a) * 2
    ab_b = ab_a
    sum += C * ab_a
    if ab_b / 2 < Y:
        if B < C / 2:
            b = round(Y - ab_b / 2)
            sum += B * b
        else:
            sum += C * int(Y - (ab_b / 2)) * 2
    if sum < INF:
        INF = sum
print(INF)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
ans = 0
flag = 0
if a + b < 2*c:
    ans = a*x + b*y
elif a + b > 2*c:
    if x > y:
        if a > 2*c:
            ans = 2*c*x
            flag = 1
        elif a <= 2*c:
            ans = 2*c*y + a*(x-y)
            flag = 2
    elif x < y:
        if b > 2*c:
            ans = 2*c*y
            flag  = 3
        elif b <= 2*c:
            ans = 2*c*x + a*(y-x)
            flag = 4
    elif x == y :
        ans = 2*c*x
        flag = 5
# print(flag)
print(ans)

Submission status: Wrong Answer

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

num_A = 0
num_B = 0
num_AB = 0
if A + B <= 2 * C:
    num_A = X
    num_B = Y
else:
    Z = min(X, Y)
    X = X - Z
    Y = Y - Z
    num_AB = 2 * Z
    if A >= 2 * C:
        num_AB += 2 * X
    else: # A < 2 * C
        num_A = X
    if B >= 2 * C:
        num_AB += 2 * Y
    else: # B < 2 * C
        num_B = Y

ans = A * num_A + B * num_B + C * num_AB
print(str(num_A) + ' ' + str(num_B) + ' ' + str(num_AB))
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
lst=s.split(" ")
a=int(lst[0])
b=int(lst[1])
c=int(lst[2])
x=int(lst[3])
y=int(lst[4])
minval=min([x,y])
maxval=max([x,y])
if(x==y):
    if((a+b)/2<c):
        print(a*x+b*y)
    else:
        print((a+b)*y)
else:
    if((a+b)/2<c):
        print(a*x+b*y)
    else:
        ans1side=c*minval*2
        dif=maxval-minval
        if(minval==x):
            print(ans1side+dif*a)
        else:
            print(ans1side+dif*b)

Submission status: Wrong Answer

Solution code:
import sys
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:
  if X==Y:
    print((A+B)*X)
    sys.stderr.write("1")
  elif X>Y:
    print((A+B)*Y+min(A,2*C)*(X-Y))
    sys.stderr.write("2")
  else:
    print((A+B)*X+min(B,2*C)*(Y-X))
    sys.stderr.write("3")
else:
  if X==Y:
    if X%2==0:
      sys.stderr.write("4")
      print(X*2*C)
    else:
      sys.stderr.write("5")
      print((X-1)*2*C+min(A+B,2*C))
  elif X>Y:
    if Y%2==0:
      sys.stderr.write("6")
      print(Y*2*C+(X-Y)*min(A,2*C))
    else:
      sys.stderr.write("7")
      print((Y-1)*2*C+(X-Y+1)*min(A,2*C))
  else:
    if X%2==0:
      sys.stderr.write("8")
      print(X*2*C+(Y-X)*min(B,2*C))
    else:
      sys.stderr.write("9")
      if C>A:
        print((X-1)*2*C+(Y-X+1)*min(B,2*C))
      else:
        print((X-1)*2*C+(Y-X+1)*min(B,2*C)+A)

Submission status: Wrong Answer

Solution code:
import sys
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:
  if X==Y:
    print((A+B)*X)
    sys.stderr.write("1")
  elif X>Y:
    print((A+B)*Y+min(A,2*C)*(X-Y))
    sys.stderr.write("2")
  else:
    print((A+B)*X+min(B,2*C)*(Y-X))
    sys.stderr.write("3")
else:
  if X==Y:
    if X%2==0:
      sys.stderr.write("4")
      print(X*2*C)
    else:
      sys.stderr.write("5")
      print((X-1)*2*C+min(A+B,2*C))
  elif X>Y:
    if Y%2==0:
      sys.stderr.write("6")
      print(Y*2*C+(X-Y)*min(A,2*C))
    else:
      sys.stderr.write("7")
      print((Y-1)*2*C+(X-Y+1)*min(A,2*C))
  else:
    if X%2==0:
      sys.stderr.write("8")
      print(X*2*C+(Y-X)*min(B,2*C))
    else:
      sys.stderr.write("9")
      if C<A:
        print((X-1)*2*C+(Y-X+1)*min(B,2*C))
      else:
        print((X-1)*2*C+(Y-X+1)*min(B,2*C)+A)

Submission status: Wrong Answer

Solution code:
import sys
A,B,C,X,Y=map(int,input().split())
if A+B<2*C:
  if X==Y:
    print((A+B)*X)
    sys.stderr.write("1")
  elif X>Y:
    print((A+B)*Y+min(A,2*C)*(X-Y))
    sys.stderr.write("2")
  else:
    print((A+B)*X+min(B,2*C)*(Y-X))
    sys.stderr.write("3")
else:
  if X==Y:
    if X%2==0:
      sys.stderr.write("4")
      print(X*2*C)
    else:
      sys.stderr.write("5")
      print((X-1)*2*C+min(A+B,2*C))
  elif X>Y:
    if Y%2==0:
      sys.stderr.write("6")
      print(Y*2*C+(X-Y)*min(A,2*C))
    else:
      sys.stderr.write("7")
      print((Y-1)*2*C+(X-Y+1)*min(A,2*C))
  else:
    if X%2==0:
      sys.stderr.write("8")
      print(X*2*C+(Y-X)*min(B,2*C))
    else:
      sys.stderr.write("9")
      print((X-1)*2*C+(Y-X+1)*min(B,2*C))

Submission status: Wrong Answer

Solution code:

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

res = 10**10
for i in range(0, max(x, y) * 2, 2):
    a_piza = x - (i // 2)
    b_piza = y - (i // 2)
    res = min(res, a_piza*a + b_piza*b + i*c)

print(res)

Submission status: Wrong Answer

Solution code:
# Problem: https://atcoder.jp/contests/arc096/tasks/arc096_a
# Python 1st Try

import sys
# from collections import defaultdict
# import heapq,copy
import pprint as pp
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(a_price, b_price, c_price, target_x, target_y):
    result = 10000000
    for mix_i in range(0, 2 * 10^5+1, +1):
        a_i = target_x - mix_i//2
        b_i = target_y - mix_i//2
        totalPrice = max(a_i, 0) * a_price + max(b_i,0) * b_price + mix_i * c_price
        if totalPrice < result:
            # print("A={},B={},C={} -> total = {}".format(a_i, b_i, mix_i, totalPrice))
            result = totalPrice
    return result


if __name__ == "__main__":
    A, B, C, X, Y = MI()
    print("{}".format(solver(A, B, C, X, Y)))

Submission status: Wrong Answer

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

#AとBをそのまま買う
ans1 = A * X + B * Y

#ABを可能な限り買って、残りのAかBを買う
if X > Y :
  ans2 = C * Y * 2 + A * (X - Y) 
else:
  ans2 = C * X * 2 + A * (Y - X) 
#とにかくABだけ買う
ans3 = C * max(X, Y) * 2

print(min(ans1,ans2,ans3))

Submission status: Wrong Answer

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

ans[0]=a*x+b*y
if x>=y:
    ans[1]=c*2*y+a*(x-y)
    ans[2]=c*2*x
else:
    ans[1]=c*y*x+b*(y-x)
    ans[2]=c*y*2
print(min(ans))

Submission status: Wrong Answer

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

ans[0]=a*x+b*y
if x>y:
    ans[1]=c*2*y+a*(x-y)
    ans[2]=c*2*x
else:
    ans[1]=c*y*x+b*(y-x)
    ans[2]=c*y*2
print(min(ans))

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

abc = min(c * 2 * y + a * (x - y), c * 2 * x + b * (y - x))

cc = c * 2 * max(x, y)
print(min(ab, abc, cc))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split(" "))
price = []
for i in range(0, x + 1):
    for j in range(0, y + 1):
        if x - i == y - j:
            k = (x-i)*2
            price.append(a * i + b * j + c * k)
            print(str(i) + " " + str(j) + " " + str(k) + " ")

print(min(price))

Submission status: Wrong Answer

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

ans = 0
if a+b < 2*c:
    if x <= y:
        ans += x*(a+b)
        if b < 2*c:
            ans += b*(y-x)
        else:
            ans += 2*c*(y-x)
    else:
        ans += y*(a+b)
        if a < 2*c:
            ans += a*(x-y)
        else:
            ans += 2*c*(x-y)
else:
    if x <= y:
        ans += 2*c*x
        if b < 2*c:
            ans += b*(y-x)
        else:
            ans += 2*c*(y-x)
    else:
        ans += 2*c*(x+y)

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
sum_l = []
#a,b only
sum_l.append(a*x+b*y)
#c only
sum_l.append(max(a,b)*c)
#min(x,y) 
sum_n = min(x,y)*2*c
if(x>y):
    sum_n +=(x-y)*a
else:
    sum_n += (y-x)*b
sum_l.append(sum_n)
print(min(sum_l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    judge = 0
    price = 0
#同じ枚数なのは何枚か数える
    same_num = X - Y
    if same_num < 0:
        judge = -1
        same_num = -same_num
    elif same_num > 0:
        judge = 1

    if 2*C > (A + B):
        price += (max(X,Y)-same_num)*(A + B)
    elif 2*C < (A + B):
        price += (max(X,Y)-same_num)*C*2

    if judge == 1:
        if 2*C > A:
            price += A*same_num
        elif 2*C < A:
            price += 2*C*same_num
    elif judge == -1:
        if 2*C > B:
            price += B*same_num
        elif 2*C < B:
            price += 2*C*same_num
    return price

print(main())

Submission status: Wrong Answer

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

min_sum = A*X + B*Y
for c in range(0, 200000+2,2):
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = A*X + B*Y
for c in range(0, 200000+2, 2):
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = 1e10
for c in range(0, 300000+2, 2):
    print(c)
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = 1e10
for c in range(0, 200000+2, 2):
    print(c)
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = 9999999999
for c in range(0, 200000+2, 2):
    print(c)
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = 9999999999
for c in range(0, 200000, 2):
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = 9999999999
for c in range(200000+1):
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

min_sum = 9999999999
for c in range(100000+1):
    sum = C*c
    if X - c/2 > 0:
        sum += A * (X - c/2)
    if Y - c/2 > 0:
        sum += B * (Y - c/2)
    if sum < min_sum:
        min_sum = sum
print(min_sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

__DEUBG__ = 1

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

minimum = a * x + b * y

if x > y:
    for i in range(x+1):
        N_a = i
        N_c = 2 * (x - i)
        if (y-N_c/2) < 0:
            N_b = 0
        else:
            N_b = y - int(N_c/2)
        tmp = a * N_a + b * N_b + c * N_c
        if tmp < minimum:
            minimum = tmp
            if __DEUBG__:
                print(N_a, N_b, N_c)
else:
    for i in range(y+1):
        N_b = i
        N_c = 2 * (y - i)
        if (x-N_c/2) < 0:
            N_a = 0
        else:
            N_a = x - int(N_c/2)
        tmp = a * N_a + b * N_b + c * N_c
        if tmp < minimum:
            minimum = tmp
            if __DEUBG__:
                print(N_a, N_b, N_c)

print(minimum)

Submission status: Wrong Answer

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

if x<y:
    x,y=y,x
    a,b=b,a

print(min(a*x+b*y, 2*c*x, 2*c*y-a*(x-y)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

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

Submission status: Wrong Answer

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

price = a * x + b * y

if (a + b) // 2 > c:
    if x >= y:
        price = min(2 * x * c, 2 * y * c + (x - y) * a)

    else:
        price = min(2 * x * c + (y - x) * b,  2 * y * c)

print(price)

Submission status: Wrong Answer

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

if (a + b) // 2 >= c:
    min_price = 'c'

elif a > b:
    min_price = 'b'

else:
    min_price = 'a'

if min_price == 'c':
    if x >= y:
        price = 2 * y * c + (x - y) * a

    else:
        price = 2 * x * c + (y - x) * b
else:
    price = a * x + b * y

print(price)

Submission status: Wrong Answer

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

if (a + b) // 2 > c:
    flag = 'c'
    min_price = c
elif a > b:
    flag = 'b'
    min_price = b
else:
    flag = 'a'
    min_price = a


if flag == 'c':
    if x >= y:
        price = min(2 * x * min_price, 2 * y * min_price + (x - y) * a)

    else:
        price = min(2 * x * min_price + (y - x) * b,  2 * y * min_price)
else:
    price = a * x + b * y

print(price)

Submission status: Wrong Answer

Solution code:
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b, c, x, y = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    paymin = max(a, b, c) * max(x, y)
    for ab in range(max(x, y)):
        if paymin > (2 * ab * c) + (max((x - ab), 0) * a) + (max((y - ab), 0) * b):
            paymin = (2 * ab * c) + (max((x - ab), 0) * a) + (max((y - ab), 0) * b)

    print(paymin)
resolve()

Submission status: Wrong Answer

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

M = 5000 * 2e5
for i in range(10001):
    m1 = i * A + (X - i) * 2 * C
    m2 = i * B + (Y - i) * 2 * C
    k1 = X - (Y - i)
    if k1 < 0:
        k1 = 0
    k2 = Y - (X - i)
    if k2 < 0:
        k2 = 0
    m1 += k2 * B
    m2 += k1 * A
    if X - i >= 0:
        M = min(M, m1)
    if Y - i >= 0:
        M = min(M, m2)
print(M)

Submission status: Wrong Answer

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

M = 5000 * 2e5
for i in range(10001):
    m1 = i * A + (X - i) * 2 * C
    m2 = i * B + (Y - i) * 2 * C
    if X - i < 0:
        m1 = 5000 * 2e5
    if Y - i < 0:
        m2 = 5000 * 2e5
    k1 = X - (Y - i)
    if k1 < 0:
        k1 = 0
    k2 = Y - (X - i)
    if k2 < 0:
        k2 = 0
    m1 += k2 * B
    m2 += k1 * A
    M = min(M, m1)
    M = min(M, m2)
print(M)

Submission status: Wrong Answer

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

M = 5000 * 2e5
for i in range(10001):
    m1 = i * A + (X - i) * 2 * C
    m2 = i * B + (Y - i) * 2 * C
    if X - i < 0 or Y - i < 0:
        continue
    k1 = X - (Y - i)
    if k1 < 0:
        k1 = 0
    k2 = Y - (X - i)
    if k2 < 0:
        k2 = 0
    m1 += k2 * B
    m2 += k1 * A
    M = min(M, m1)
    M = min(M, m2)
print(M)

Submission status: Wrong Answer

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

P = 1e+100
for c in range(0, int(2e+5), 2):
    a = max(0, X - c // 2)
    b = max(0, Y - c // 2)
    temp = a * A + b * B + c * C
    if temp < P:
        P = temp
print(P)

Submission status: Wrong Answer

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

P = 1e+10
for c in range(0, int(2e+5), 2):
    a = max(0, X - c // 2)
    b = max(0, Y - c // 2)
    temp = a * A + b * B + c * C
    if temp < P:
        P = temp
print(P)

Submission status: Wrong Answer

Solution code:
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1

a,b,c,x,y = readInts()

ans = 1000000000000
for i in range(0,2*(x+1)):
	B = y-(x-i)
	AB = 2*(x-i)
	if B<0 or AB<0:
		continue
	money = i*a+B*b+AB*c
	ans = min(ans,money)

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1

a,b,c,x,y = readInts()

ans = 1000000000000
for i in range(0,x+1):
	B = y-(x-i)
	AB = 2*(x-i)
	if B<0 or AB<0:
		continue
	money = i*a+B*b+AB*c
	ans = min(ans,money)

print(ans)

Submission status: Wrong Answer

Solution code:
#複数の整数入力を受け付ける関数
def datain(num):

    data = []
    iscnt = True

    while iscnt:
        for val in map(int,input().split()):
            data.append(val)
            if len(data) == num:
                iscnt = False
                break
        
    return data

INF = 10**8
data = datain(5)
ans = INF

for i in range(0,max(data[3],data[4])*2+1,2):   #ab
    
    j = data[3]-i/2 if data[3] >= i/2 else 0   #a
    k = data[4]-i/2 if data[4] >= i/2 else 0   #b
    ans = min(ans,i*data[2]+j*data[0]+k*data[1])
    #print(i,j,k)

print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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


l = [x,y]
p = 10**5 * 5000
for i in range(max(l)+1):

    x_ = x-i
    y_ = y-i
    
    if x-i < 0:
        x_= 0
    if y-i <0:
        y_ = 0
    
    if p > (i * 2*c + (x_) * a + (y_) * b):
        p = (i * 2*c + (x_) * a + (y_) * b)
print(p)

Submission status: Wrong Answer

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

if x < y:
  a,b = b,a
  x,y = y,x

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

Submission status: Wrong Answer

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

if x < y:
  a,b = b,a
  x,y = y,x

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

Submission status: Wrong Answer

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

if x < y:
  a,b = b,a
  x,y = y,x

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

Submission status: Wrong Answer

Solution code:
#-*- coding: utf-8 -*-
a, b, c, x, y = map(int, input().split())
m = min(x, y)
ans = 0
if (a + b) >= c * 2:
    ans += c * 2 * min(x, y)
    print(ans)
    x -= m
    y -= m

if a >= c * 2:
    ans += c * 2 * x
    x = 0
if b >= c * 2:
    ans += c * 2 * y
    y = 0
print(ans + x*a + y*b)