Problem: "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.

Submission attempts (in order):
A,B,C,X,Y = map(int,input().split())

D = (A + B) // 2
C2 = C * 2

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 > max(A,B):
  ans += (A * X) + (B * Y)
  print(ans)
else:
  if D >= C:
    if X > Y:
      ans += C2 * Y
      ans += A * (X - Y)
      print(ans)
    if Y > X:
      ans += C2 * X
      ans += B * (Y - X)
      print(ans)
  else:
    ans += (A * X) + (B * Y)
    print(ans)

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)

elif C2 > A + B:
  ans += (A * X) + (B * Y)

elif C2 <= A + B:
  if A > B:
    ans += C2 * Y + A * diff

  else:
    ans += C2 * X + B * diff
    
print(ans)

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

D = (A + B) // 2
C2 = C * 2

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 > max(A,B):
  ans += (A * X) + (B * Y)
  print(ans)
else:
  if D >= C:
    if X > Y:
      ans += C2 * Y
      ans += A * (X - Y)
      print(ans)
  else:
    ans += (A * X) + (B * Y)
    print(ans)

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans = C2 * max(X,Y)

elif C2 > A + B:
  ans = (A * X) + (B * Y)

elif C2 <= A + B:
  if A > B:
    ans = C2 * Y + A * diff

  else:
    ans = C2 * X + B * diff
    
print(ans)


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

D = (A + B) // 2
C2 = C * 2

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 > max(A,B):
  ans += (A * X) + (B * Y)
  print(ans)
else:
  if D >= C:
    if X > Y:
    ans += C2 * Y
    ans += A * (X - Y)
    print(ans)
  else:
    ans += (A * X) + (B * Y)
    print(ans)

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)

elif C2 > A + B:
  ans += (A * X) + (B * Y)

elif C2 < A + B:
  if A > B:
    ans += C2 * Y + A * diff

  else:
    ans += C2 * X + B * diff
    
print(ans)

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 > A + B:
  ans += (A * X) + (B * Y)
  print(ans)
elif C2 < A + B:
  if A > B:
    ans += C2 * Y + A * diff
  else:
    ans += C2 * X + B * diff

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

C2 = C * 2
diff = abs(X - Y)

ans = 0


if C2 > A + B:
  ans = (A * X) + (B * Y)

elif C2 <= A + B:
  if X > Y:
    ans = min(C2 * Y + A * diff,C2 * X)

  else:
    ans = min(C2 * X + B * diff,C2 * Y)
    
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted