problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p03371 | s885616478 | Accepted | A,B,C,X,Y = (int(X) for X in input().split())
MINPrice = pow(10,9)
for ABP in range(0,2*max(X,Y)+1,2):
Price = A*max(0,(X-ABP//2))+B*max(0,(Y-ABP//2))+C*ABP
if Price<=MINPrice:
MINPrice = Price
print(MINPrice) |
p03371 | s049085731 | Accepted | A,B,C,X,Y = map(int,input().split())
plan1 = (A*X) + (B*Y)
plan2 = (C*2) * max(X,Y)
plan3 = (C*2) * X + B*(Y-X)
plan4 = (C*2) * Y + A*(X-Y)
if X <= Y:
print(min(plan1,plan2,plan3))
else:
print(min(plan1,plan2,plan4))
|
p03371 | s800663598 | Accepted | A,B,C,X,Y = map(int,input().split())
ans = 2*max(X,Y)*C
ans = min(ans,A*X+B*Y)
if X>=Y:ans = min(ans,2*Y*C+(X-Y)*A)
else:ans = min(ans,2*X*C+(Y-X)*B)
print(ans) |
p03371 | s067192593 | Accepted | # abc_95_c
# import sys
from sys import stdin
A, B, C, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = 0
# ans2 = 0
if C < (A/2)+(B/2):
if X > Y:
ans1 = C*2*min(X, Y)+(max(X, Y)-min(X, Y))*A
else:
ans1 = C*2*min(X, Y)+(max(X, Y)-min(X, Y))*B
else:
ans1 = A*X+B*Y
ans2 = C*2*max(X, Y)
print(min(ans1, ans2))
|
p03371 | s653772074 | Accepted | A,B,C,X,Y = map(int, input().split())
n = min(X,Y)
sum = 0
sum = min(n*2*C, A*n+B*n)
if X>Y:
n = X-n
sum = sum + n*A
else:
n = Y - n
sum = sum + n*B
sum_ab = X*A + Y*B
sum_a_b = 2*max(X,Y)*C
print(min(sum,sum_ab,sum_a_b)) |
p03371 | s927852688 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = X*A + Y*B
if X>Y:
ans = min(X*A + Y*B, 2*X*C, 2*Y*C+(X-Y)*A)
else:
ans = min(X*A + Y*B, 2*Y*C, 2*X*C+(Y-X)*B)
print(ans) |
p03371 | s822090846 | Accepted | a, b, c, x, y = map(int, input().split())
mini = min(x, y)
A = a*x + b*y
B = 2*c*mini + a*(x - mini) + b*(y - mini)
C = 2*c*max(x, y)
print(min(A, B, C)) |
p03371 | s503839591 | Accepted | # C
a, b, c, x, y = map(int, input().split())
ans = 0
while min(x,y) != 0:
if min(x, y) == x:
ans += x*min(a+b, 2*c)
y -= x
x = 0
elif min(x, y) == y:
ans += y*min(a+b, 2*c)
x = x - y
y = 0
if x == 0:
ans += y*min(b, 2*c)
elif y == 0:
ans += x*min(a, 2*c)
print(ans) |
p03371 | s600474530 | Accepted | def resolve():
import sys
input = sys.stdin.readline
a,b,c,x,y=map(int,input().split())
z=min(x,y)
ans=min(a*x+b*y,a*(x-z)+b*(y-z)+c*z*2,max(x,y)*2*c)
print(ans)
if __name__ == '__main__':
resolve() |
p03371 | s553211096 | Accepted | a, b, ab, x, y = [int(i) for i in input().split()]
if a + b < 2 * ab:
print(a * x + b * y)
else:
ans = min(x, y) * 2 * ab
if x > y:
ans += min((x - y) * 2 * ab, (x - y) * a)
elif y > x:
ans += min((y - x) * 2 * ab, (y - x) * b)
print(ans)
|
p03371 | s101952099 | Accepted | a, b, c, x, y = map(int, input().split())
ans = a*x + b*y
if x < y:
ans = min(ans, 2*c*x + b*(y - x))
else:
ans = min(ans, 2*c*y + a*(x - y))
ans = min(ans, 2*c*max(x, y))
print(ans) |
p03371 | s471284270 | Accepted | def main():
A, B, AB, X, Y = map(int, input().split())
M = max(X, Y)
k = 0
ans = A * X + B * Y
while True:
ans = min(
ans,
AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B
)
if k >= M: break
k += 1
print(ans)
if __name__ == '__main__':
main()
|
p03371 | s186926529 | Accepted | [a,b,c,x,y] = [int(x) for x in input().split()]
total_price = a*x+b*y
max_num = max(x,y)
for i in range(0,(max_num+1)*2,2):
new_x = 0 if x-i//2 <= 0 else x-i//2
new_y = 0 if y-i//2 <= 0 else y-i//2
current_price = i*c + new_x*a + new_y*b
if current_price < total_price:
total_price = current_price
print(total_price) |
p03371 | s312044006 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 10**18
for i in range(10**5+1):
temp = 2*i*c + max(0,x-i)*a + max(0,y-i)*b
ans = min(ans,temp)
print(ans)
|
p03371 | s107266880 | Accepted | A, B, C, X, Y = map(lambda x: int(x), input().split())
price = A * X + B * Y
for Z in range(2, X * 2 + 1 if X > Y else Y * 2 + 1, 2):
x, y = int(X - Z / 2), int(Y - Z / 2)
x, y = 0 if x < 0 else x, 0 if y < 0 else y
next_price = A * x + B * y + C * Z
if next_price >= price:
break
price = next_price
print(price)
|
p03371 | s658345561 | Accepted | import sys
import math
ans = float('inf')
a,b,c,x,y = map(int,sys.stdin.readline().rstrip().split())
for i in range(max(x,y)+1):
if x > y and i >= y:
sum = a * (x - i) + 2 * i * c
elif y > x and i >= x:
sum = b * (y - i) + 2 * i * c
else:
sum = a * (x - i) + b * (y - i) + 2 * i * c
ans = min(ans,sum)
print(ans) |
p03371 | s597320880 | Accepted | A, B, C, X, Y = map(int, input().split())
D = {X:A, Y:B}
print(min(A*X+B*Y, 2*C*min(X, Y) + D[max(X, Y)]*(max(X, Y) - min(X, Y)), 2*C*max(X, Y))) |
p03371 | s929487852 | Accepted | a, b, c, x, y = map(int, input().split())
ans = float('inf')
for i in range(10**5 + 1):
tmp = c*2*i + max(0, x-i) * a + max(0, y-i) * b
ans = min(ans, tmp)
print(ans) |
p03371 | s382240887 | Accepted | A,B,C,X,Y = map(int, input().split())
ans = float('inf')
for i in range(0,max(X,Y)*2+1,2):
s = 0
x = X-i//2
y = Y-i//2
if x >= 1:
s += x*A
if y >= 1:
s += y*B
s += i*C
ans = min(ans, s)
print(ans) |
p03371 | s149398500 | Accepted | A, B, C, X, Y = list(map(int,input().split()))
ans = float('Inf')
for i in range(max(X,Y)*2+1):
tmp = i * C
if i / 2 < X:
tmp += A*(X-i//2)
if i / 2 < Y:
tmp += B*(Y-i//2)
ans = min(ans,tmp)
print(ans) |
p03371 | s978098541 | Accepted | a,b,c,x,y=[int(i) for i in input().split()]
#直接買ったほうが安いとき
if a+b<c*2:
print(a*x+b*y)
#AピザよりもABピザ2枚のほうが安い
elif a+b>=c*2:
if x-y>0 and a<=2*c:
print(2*c*y+(x-y)*a)
elif y-x>0 and b<=2*c:
print(2*c*x+(y-x)*b)
elif x-y>0:
print(x*2*c)
else:
print(y*2*c)
|
p03371 | s423006726 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 0
if (A+B)/2 >= C:
if X >= Y:
if A/2 <= C:
ans += C * Y * 2
ans += A * (X-Y)
else:
ans += C * X * 2
else:
if B/2 <= C:
ans += C * X * 2
ans += B * (Y-X)
else:
ans += C * Y *2
else:
ans = A*X + B*Y
print(ans) |
p03371 | s832516566 | Accepted | A,B,C,X,Y = list(map(int,input().split()))
if C*2 <= A+B:
ans = 0
ans += C*2*min(X,Y)
ans += min(A,C*2)*(X-Y) if Y<X else min(B,C*2)*(Y-X)
print(ans)
else:
print(A*X+B*Y) |
p03371 | s981207990 | Accepted | a,b,c,x,y=map(int,input().split())
z,w=min(x,y),max(x,y)
print(min(min(a*x+b*y,a*(x-z)+b*(y-z)+c*z*2),c*2*w)) |
p03371 | s395153650 | Accepted | import numpy as np
A, B, C, X, Y = list(map(int, input().split()))
min_money = A*X + B*Y
status = np.array([X,Y,0])
delta_status = np.array([-1,-1,2])
block_status = np.array([0,0,0])
values = np.array([A,B,C])
for _ in range(max(X,Y)):
status += delta_status
status = np.max(np.array([status,block_status]), axis=0)
tmp_money = sum(status * values)
min_money = min(tmp_money,min_money)
print(min_money) |
p03371 | s203363465 | Accepted | a,b,c,x,y = map(int,input().split())
xy = max(x,y)*2+1
print(min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])) |
p03371 | s723149015 | Accepted | a,b,c,x,y=map(int,input().split())
ans=1000000000000000000000000
for i in range(100001):
tmp=i*2*c+max(0,x-i)*a+max(0,y-i)*b
ans=min(ans,tmp)
print(ans) |
p03371 | s076217716 | Accepted | a, b, c, x, y = map(int, input().split())
answer = 7000000000
for i in range(100001):
amount = i*2*c + max(0, x-i)*a + max(0, y-i)*b
if answer > amount:
answer = amount
print(answer) |
p03371 | s979367978 | Accepted | A, B, C, X, Y = map(int, input().split())
non_AB = A*X + B*Y
if X>Y:
#BをABから作る
non_B = C*2*Y + A*(X-Y)
#AをABから作る
non_A = C*2*X
else:
non_A = C*2*X + B*(Y-X)
non_B = C*2*Y
# print(min(non_AB, use_AB))
print(min(non_AB, non_A, non_B))
|
p03371 | s159271950 | Accepted | a,b,c,x,y=map(int,input().split())
ans=0
if a+b<=c*2:
print(a*x+b*y)
exit()
elif x>=y:
ans+=c*y*2
x-=y
if a>=c*2:
ans+=c*2*x
else:
ans+=a*x
elif y>x:
ans+=c*x*2
y-=x
if b>=c*2:
ans+=c*2*y
else:
ans+=b*y
print(ans)
|
p03371 | s217013165 | Accepted | A, B, C, X, Y = map(int, input().split())
if A + B <= 2 * C:
print(A * X + B * Y)
else:
if X > Y:
A, B, X, Y = B, A, Y, X
print(2 * X * C + (Y - X) * min(B, 2 * C))
|
p03371 | s907592928 | Accepted | a,b,c,x,y = map(int,input().split())
l = min(x,y)
m = max(x,y)
M = a * x + b * y
for i in range(1,l+1):
K = a * (x-i) + b * (y-i) + 2 * c * i #これだとマイナスになってしまう
M = min(M,K)
for i in range(l+1,m+1):
if x == l:
K = b * (y-i) + 2 * c * i
else:
K = a * (x-i) + 2 * c * i
M = min(M,K)
print(M)
|
p03371 | s417329168 | Accepted | a, b, c, x, y = map(int, input().split())
high = max(x, y)
low = min(x, y)
if a + b <= c * 2:
res = a * x + b * y
else:
if high == x:
res = low * c*2 + (high - low) * a
else:
res = low * c*2 + (high - low) * b
res = min( res, c*2 * high )
print(res)
|
p03371 | s507293588 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float("inf")
for i in range(max(X, Y)+1):
x = max(X - i, 0)
y = max(Y - i, 0)
cost = 2*C * i + A * x + B * y
ans = min(ans, cost)
print(ans) |
p03371 | s167074309 | Accepted | a, b, c, x, y = map(int, input().split())
ans = float('inf')
for i in range(2 * 10**5 + 1):
ans = min(ans, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)
print(ans) |
p03371 | s561328680 | Accepted | ## C - Half and Half
import math
A, B, C, X, Y = map(int, input().split())
money = []
for i in range(0, max(X,Y) + 1 ):
val = 0
val += A * (X - i) if X - i > 0 else 0
val += B * (Y - i) if Y - i > 0 else 0
money.append( val + C * 2*i )
print(min(money)) |
p03371 | s631118042 | Accepted | def LI():return map(int,input().split())
def I(): return input().split()
a,b,c,x,y=LI()
lst=0
ans=float("inf")
for i in range(10**5+1):
ans=min(ans,(2*i*c+max(0,x-i)*a+max(0,y-i)*b))
print(ans) |
p03371 | s730998028 | Accepted | import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#n = int(input())
a, b, c, x, y = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))
n = max(x, y)
ans = 10 ** 10
for i in range(n+1):
p = max(x - i, 0)
q = max(y - i, 0)
r = 2 * i * c + p * a + q * b
if r < ans:
ans = r
print(ans)
|
p03371 | s167458825 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 10**19
ans = min(ans,a*x+b*y)
ans = min(ans,c*max(x,y)*2)
if x <= y:
ans = min(ans,c*x*2+(y-x)*b)
else:
ans = min(ans,c*y*2+(x-y)*a)
print(ans) |
p03371 | s128658235 | Accepted | a,b,c,x,y=map(int,input().split())
cost=0
val=min(x,y)
x-=val
y-=val
if a+b>=2*c:
cost+=val*2*c
else:
cost+=val*a
cost+=val*b
if x:
cost+=x*min(a,2*c)
if y:
cost+=y*min(b,2*c)
print(cost)
|
p03371 | s146334678 | Accepted | I = [int(i) for i in input().split()]
A, B, AB, X, Y = I
ans = 1e+15
for i in range(max(X,Y)+1):
price = A*max(X-i, 0) + B*max(Y-i, 0) + AB*2*i
ans = min(ans, price)
print(ans) |
p03371 | s195059874 | Accepted | A,B,C,X,Y = map(int,input().split())
c = []
for i in range(10 ** 5 + 1):
cash = 2 * C * i + A * max(0,X - i) + B * max(0, Y - i)
c.append(cash)
print(min(c)) |
p03371 | s853426993 | Accepted | a,b,c,x,y = map(int, open(0).read().split())
ans = 1 << 31
for i in range(max(x,y)+1):
ans = min(ans, i*2*c + max(x-i, 0)*a + max(y-i, 0)*b)
print(ans) |
p03371 | s653698074 | Accepted | A, B, C, X, Y = map(int, input().split())
C *= 2
t,s,P = 0,max(X,Y),1000000000000
while s>=0:
P = min(P, C*s+A*max(X-s, 0)+B*max(Y-s, 0))
s -= 1
print(P) |
p03371 | s485393355 | Accepted | def main():
a,b,ab,ac,bc = map(int,input().split())
price = 0
if a+b < ab*2:
price = a*ac + b*bc
else:
if ac < bc:
price += ab*ac*2
x = bc-ac
price += min(x*b, x*ab*2)
else:
price += ab*bc*2
x = ac-bc
price += min(x*a, x*ab*2)
print(price)
if __name__ == "__main__":
main() |
p03371 | s156928776 | Accepted | import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
A,B,C,X,Y = map(int, readline().split())
Z = min(X, Y)
if A + B >= C * 2:
ans = min(C * Z * 2 + A * (X - Z) + B * (Y - Z), C * max(X, Y) * 2)
else:
ans = A * X + B * Y
print(ans)
if __name__ == '__main__':
main() |
p03371 | s861465486 | Accepted | def solve():
A, B, C, X, Y = map(int, input().split())
C *= 2
mn = float('inf')
for i in range(max(X,Y)+1):
price = 0
price += C * i
if Y - i > 0:
price += B * (Y - i)
if X - i > 0:
price += A * (X - i)
mn = min(price, mn)
print(mn)
if __name__ == '__main__':
solve() |
p03371 | s002154543 | Accepted | # C - Half and Half
A, B, C, X, Y = map(int, input().split())
ans = A*X + B*Y
if A+B > C*2:
m = min(X, Y)
ans -= (A+B-(C*2)) * m
X -= m
Y -= m
if X > 0 and A > C*2:
ans -= (A-(C*2)) * X
Y -= X
if Y > 0 and B > C*2:
ans -= (B-(C*2)) * Y
Y -= Y
print(ans) |
p03371 | s236240914 | Accepted | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
import math
a,b,c,x,y=map(int, input().split())
cmax=max(x,y)*2
l=[]
for i in range(cmax+1):
amai = max(math.ceil(x - 0.5 * i),0)
bmai = max(math.ceil(y - 0.5 * i),0)
l.append(amai*a+bmai*b+i*c)
print(min(l))
resolve() |
p03371 | s991715590 | Accepted | import sys
sys.setrecursionlimit(10**9)
A, B, C, X, Y = map(int, input().split())
cost1 = A * X + B * Y
cost2 = max(X, Y) * 2 * C
if X <= Y:
cost3 = X * 2 * C + (Y - X) * B
else:
cost3 = Y * 2 * C + (X - Y) * A
print(min([cost1, cost2, cost3]))
|
p03371 | s767582202 | Accepted | a, b, c, x, y = map(int, input().split())
res1 = a * x + b * y
if x < y:
res2 = c * x * 2 + b * (y - x)
else:
res2 = c * y * 2 + a * (x - y)
res3 = c * max(x, y) * 2
res = min(res1, res2, res3)
print(res)
|
p03371 | s613496705 | Accepted | A, B, C, X, Y = map(int,input().split())
if A + B <= 2 * C:
ans = A * X + B * Y
else:
if X <= Y:
ans = 2 * C * X + (Y - X) * B
else:
ans = 2 * C * Y + (X - Y) * A
if ans > 2 * C *(max(X, Y)):
ans = 2 * C *(max(X, Y))
print(ans)
|
p03371 | s495494567 | Accepted | a,b,c,x,y = map(int,input().split())
smallestSum = 0
tempSum = 0
smallestSum = a * x + b * y
if x < y:
tempSum = c * x * 2 + b * (y - x)
if tempSum < smallestSum:
smallestSum = tempSum
tempSum = c * y * 2
if tempSum < smallestSum:
smallestSum = tempSum
else:
tempSum = c * y * 2 + a * (x - y)
if tempSum < smallestSum:
smallestSum = tempSum
tempSum = c * x * 2
if tempSum < smallestSum:
smallestSum = tempSum
print(smallestSum) |
p03371 | s449825475 | Accepted | a,b,ab,x,y=map(int,input().split())
if x<y:
#print((y-x)*b+x*ab*2)
print(min((y-x)*b+x*ab*2 , a*x+b*y , y*ab*2))
else:#x>=y
#print((x-y)*a+y*ab*2)
print(min((x-y)*a+y*ab*2,a*x+b*y , x*ab*2))
|
p03371 | s036769270 | Accepted | # pattern1:Only A-pizza/B-pizza
# pattern2:Only C-pizza
# pattern2:C-pizza & A or B-pizza
a, b, c, x, y = map(int, input().split())
price1 = x * a + y * b
price2 = max(x, y) * 2 * c
price3 = min(x, y) * 2 * c + a * (x - min(x, y)) + b * (y - (min(x, y)))
print(min(price1, price2, price3))
|
p03371 | s848446796 | Accepted | A,B,C,X,Y=map(int, input().split())
if X>=Y:ans,Ccnt=C*X*2,X*2
else:ans,Ccnt=C*Y*2,Y*2
for c in range(1,Ccnt//2+1):
temp=(Ccnt-2*c)*C
if (Ccnt-c*2)//2<Y:
temp+=(Y-(Ccnt-c*2)//2)*B
if (Ccnt-c*2)/2<X:
temp+=(X-(Ccnt-c*2)//2)*A
#print(X-(Ccnt-c*2)/2,Y-(Ccnt-c*2)/2,Ccnt-2*c,temp)
ans=min(ans,temp)
print(ans) |
p03371 | s482673314 | Accepted | A,B,C,X,Y = map(int,input().split())
if A+B < C*2:
print(A*X+B*Y)
elif X > Y:
if A < C*2:
print(Y*C*2+(X-Y)*A)
else:
print(X*C*2)
else:
if B < C*2:
print(X*C*2+(Y-X)*B)
else:
print(Y*C*2) |
p03371 | s528442163 | Accepted | a, b, c, x, y = map(int, input().split())
ans = min(x*a+y*b, max(x,y)*c*2)
if x>y: ans = min(ans, y*c*2+(x-y)*a)
else: ans = min(ans, x*c*2+(y-x)*b)
print(ans) |
p03371 | s734118462 | Accepted | A, B, C, X, Y = map(int, input().split())
C *= 2
ans = 0
if A + B <= C:
ans += A * X + B * Y
else:
min_num = min(X, Y)
ans += min_num * C
X -= min_num
Y -= min_num
if X > 0:
if A > C:
ans += X * C
else:
ans += X * A
if Y > 0:
if B > C:
ans += Y * C
else:
ans += Y * B
print(ans) |
p03371 | s542858614 | Accepted | a,b,c,x,y=map(int,input().split())
#A,Bをそれぞれ買う
cand1=a*x+b*y
#すべてABピザでそろえる
cand2=2*c*max(x,y)
#A,Bのうち必要枚数が少ないほうをすべてABピザで作る
cand3=2*c*x+b*(y-x) if x<y else 2*c*y+a*(x-y)
print(min(cand1,cand2,cand3)) |
p03371 | s354848291 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 0
if a+b > 2*c:
ans = c*2*min(x,y)
if x<y:
if b > 2 * c:
ans += 2*c*(y-x)
else:
ans += b*(y-x)
else:
if a > 2 * c:
ans += 2*c*(x-y)
else:
ans += a*(x-y)
else:
ans = a*x+b*y
print(ans)
|
p03371 | s043547845 | Accepted | A, B, C, X, Y = map(int, input().split())
res = float("inf")
for i in range(0, max(X, Y) * 2 + 1, 2):
Amai = max(0, X - i // 2)
Bmai = max(0, Y - i // 2)
res = min(res, A * Amai + B * Bmai + C * i)
print(res)
|
p03371 | s196629979 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for ab in range(0, 2 * (max(X, Y) + 1), 2):
cost = ab * C + max(0, (X - ab // 2)) * A + max(0, (Y - ab // 2)) * B
ans = min(ans, cost)
print(ans) |
p03371 | s138416220 | Accepted | A,B,C,X,Y=map(int,input().split())
ans = A*X + B*Y
tmp = A*X + B*Y
x = X
y = Y
z = 0
while x >= 0 or y >= 0:
tmp = A*max(0,x) + B*max(0,y) + C*z
ans = min(ans,tmp)
x=x-1
y=y-1
z=z+2
print(ans) |
p03371 | s575574785 | Accepted | a, b, c, x, y = map(int, input().split())
m = min(x, y)
M = max(x, y)
p = a * x + b * y
q = c*m*2 + a*(x-m) + b*(y-m)
r = c*M*2
print(min(p, q, r)) |
p03371 | s644264721 | Accepted | A,B,C,X,Y = map(int,input().split())
if A+B>=2*C:
ans = 2*C*min(X,Y)
if X>=Y:
ans += (X-Y)*min(A,2*C)
else:
ans += (Y-X)*min(B,2*C)
else:
ans = (A+B)*min(X,Y)
if X>=Y:
ans += (X-Y)*A
else:
ans += (Y-X)*B
print(ans) |
p03371 | s784302472 | Accepted | a, b, c, x, y = map(int, input().split())
#a, b, c, x, y = 1500, 2000, 500, 90000, 100000
#na, nb, nc = x, y, 0
mx = 10**18
for i in range(0, max(x,y)*2+1):
if i%2==1: continue
total = max(a*(x-i//2), 0) + max(b*(y-i//2), 0) + c*i
if total<mx:
mx=total
print(mx)
|
p03371 | s026066983 | Accepted | a,b,c,x,y = map(int,input().split())
ans = float("inf")
for i in range(max(x,y)+1):
ans = min(ans, 2*c*i+max(0,x-i)*a+max(0,y-i)*b)
print(ans) |
p03371 | s818616875 | Accepted | # https://atcoder.jp/contests/abc095/tasks/arc096
# 値段,枚数
A, B, C, X, Y = map(int, input().split())
# C * 2 は A + Bとなる
ans = max(X, Y) * 2 * C
ans = min(ans, A * X + B * Y)
if X > Y:
ans = min(ans, (X - Y) * A + 2 * C * Y)
elif Y > X:
ans = min(ans, (Y - X) * B + 2 * C * X)
print(ans) |
p03371 | s096063420 | Accepted | A,B,C,X,Y = [int(i) for i in input().split()]
if A + B < C * 2:
print(A*X + B*Y)
else:
p1 = min(X,Y) * C * 2 + (X - min(X,Y))*A + (Y - min(X,Y))*B
p2 = max(X,Y) * C * 2
print(min(p1, p2)) |
p03371 | s775753721 | Accepted | a, b, c, x, y = map(int,input().split())
res = min(a*x + b*y, max(x, y) * 2 * c)
if x < y:
temp = x * 2 * c + (y - x) * b
else:
temp = y * 2 * c + (x - y) * a
print(min(res, temp)) |
p03371 | s689775330 | Accepted | a, b, c, x, y = map(int, input().split())
if a+b <= 2*c:
print(a*x+b*y)
else:
if x < y:
print(min(c*x*2+b*(y-x), 2*y*c))
else:
print(min(a*(x-y)+c*y*2, 2*x*c)) |
p03371 | s498603373 | Accepted | A,B,C,X,Y = map(int,input().split())
ans = float('inf')
for c in range(max(X,Y) + 1):
tmp = c*2*C
tmp += max(0,X-c)*A
tmp += max(0,Y-c)*B
ans = min(ans, tmp)
print(ans) |
p03371 | s437611390 | Accepted | A,B,C,X,Y=[int(x) for x in input().split(' ')]
cmin=max([X,Y])
lis=[]
for i in range(cmin+1):
i_c=i*2
i_a, i_b=X-i,Y-i
# print(i_a,i_b,i_c)
if i_a>=0 and i_b>=0:
lis.append(i_c*C+i_b*B+i_a*A)
if i_a<0:
if i_b<0:
lis.append(i_c*C)
else:
lis.append(i_c*C+i_b*B)
elif i_b<0:
lis.append(i_c*C+i_a*A)
print(min(lis))
|
p03371 | s332673874 | Accepted | pa, pb, pab, na, nb = map(int, input().split())
'''
1. そのまま
2. 少ない方全てをabで
3. abいっぱいで余らせる
'''
ans1 = pa * na + pb * nb
ans2 = pab * min(na, nb) * 2 + (pa if(na > nb) else pb) * abs(na - nb)
ans3 = pab * max(na, nb) * 2
print(min(ans1, ans2, ans3))
|
p03371 | s145828689 | Accepted | a,b,c,x,y = map(int, input().split())
ans = 10**12
for i in range(0, (max(x,y)*2)+1, 2):
xr = max(x-(i//2), 0)
yr = max(0, y-(i//2))
if ans > (i*c)+(xr*a)+(yr*b):
ans = (i*c)+(xr*a)+(yr*b)
print(ans) |
p03371 | s813774804 | Accepted | A,B,C,X,Y = map(int,input().split())
ans = 100000000000000000000000000000000000000
for c in range (0,100001):
price = A*max(0,X-c)+B*max(0,Y-c)+C*2*c
if price < ans:
ans = price
print(int(ans))
|
p03371 | s132439912 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = None
for ab_count in range(0, max(X, Y) * 2 + 1, 2):
a_count = max(0, X - ab_count // 2)
b_count = max(0, Y - ab_count // 2)
amount = a_count * A + b_count * B + ab_count * C
if ans is None:
ans = amount
else:
ans = min(ans, amount)
print(ans) |
p03371 | s211053955 | Accepted | A,B,C,X,Y = map(int,input().split())
if X-Y>=0:
print(min(A*X+B*Y,A*(X-Y)+C*2*Y,C*2*X))
else:
print(min(A*X+B*Y,B*(Y-X)+C*2*X,C*2*Y)) |
p03371 | s976488472 | Accepted | A, B, C, X, Y = map(int, input().split())
mini = float('inf')
for i in range(10**6 + 1):
calc = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B
if calc < mini:
mini = calc
print(mini) |
p03371 | s864933486 | Accepted | a,b,c,x,y = map(int,input().split())
ab = c*2 #A,B1枚ずつ入手
if ab <= a+b:
bab = min(x,y)*ab
if x > y:
bother = (max(x,y)-min(x,y))*a
else:
bother = (max(x,y)-min(x,y))*b
ans = min(bab+bother,ab*max(x,y))
else:
bab = 0
bother = a*x + b*y
ans = bab + bother
print(ans) |
p03371 | s334716680 | Accepted | A,B,C,X,Y = map(int,input().split())
if A + B < 2 * C:
ans = A * X + B * Y
else:
ans = min(X,Y) * 2 * C
if X < Y:
Z = Y - X
ans += Z * min(B,2*C)
else:
Z = X - Y
ans += Z * min(A,2*C)
print(ans) |
p03371 | s019544906 | Accepted | A,B,C,X,Y=map(int,input().split())
ans=10**9
my_min=min(X,Y)
my_max=max(X,Y)
ans1=2*C*my_min+A*(X-my_min)+B*(Y-my_min)
ans2=2*C*my_max
ans3=A*X+B*Y
print(min(ans1,ans2,ans3)) |
p03371 | s641257853 | Accepted | #from math import gcd
from math import factorial as f
from math import ceil,floor,sqrt
import bisect
import re
import heapq
from copy import deepcopy
import itertools
from sys import exit
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
yes = "Yes"
no = "No"
def main():
a,b,c,x,y = mi()
ans = 1<<60
for i in range(max(x,y)+1):
ans = min(max(x-i,0)*a+max(y-i,0)*b+2*i*c,ans)
print(ans)
main()
|
p03371 | s683217751 | Accepted | #n = int(input())
a,b,c,x,y = map(int,input().split())
#a_L = list(map(int,input().split()))
price = float("inf")
for i in range(10**7):
price = min(price,i*2*c + max(0,x-i)*a + max(0,y-i)*b)
print(price)
|
p03371 | s855647857 | Accepted | a,b,c,x,y=list(map(int,input().split()))
money=a*x+b*y
for i in range(max(2*x+1,2*y+1)):
a_money=max(a*(x-i),0)
b_money=max(b*(y-i),0)
money=min(money,a_money+b_money+i*c*2)
print(money) |
p03371 | s481306585 | Accepted | A,B,C,X,Y = input().split(' ')
#print(A,B,C,X,Y)
ans = 10 ** 12
for i in range(0,100001):
tmp = int(C) * 2 * i + int(A) * max(int(X)-i,0) + int(B) * max(int(Y)-i,0)
ans = min(ans,tmp)
print(ans) |
p03371 | s193436451 | Accepted | # solution
import io
import sys
a, b, c, x, y = map(int, input().split())
print(min([a*x+b*y, a*(x-min([x,y]))+b*(y-min([x,y]))+2*c*min([x,y]),2*c*max([x, y])])) |
p03371 | s919801354 | Accepted | #!/usr/bin/env python3
a, b, c, x, y = map(int, input().split())
print(
min(
a * x + b * y,
max(x, y) * c * 2,
c * x * 2 + (y - x) * b if y > x else c * y * 2 + (x - y) * a if x > y else 10**9,
))
|
p03371 | s477279976 | Accepted | A, B, C, X, Y = [int(i) for i in input().split()]
if X < Y:
ans = X*C*2+(Y-X)*B
else:
ans = Y*C*2+(X-Y)*A
ans = min(A*X+B*Y, max(X, Y)*C*2, ans)
print(ans)
|
p03371 | s995428317 | Accepted | a, b, c, x, y = map(int, input().split())
z = min(x, y)
if x > y:
p = 2*c*z + a*(x-z)
else:
p = 2*c*z + b*(y-z)
q = a*x + b*y
r = 2*c * max(x, y)
print(min(p, q, r))
|
p03371 | s717288089 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float("inf")
for i in range(max(X,Y)+1):
total = A*(X-min(X,i)) + B*(Y-min(Y,i)) + C*2*i
if ans > total:
ans = total
print(ans) |
p03371 | s818606125 | Accepted | a,b,c,x,y = map(int, input().split())
if (a+b) > c*2:
tmp = min(x,y)
if x > y:
print(min(c*2*tmp + a*(x-y), c*2*x))
else:
print(min(c*2*tmp + b*(y-x), c*2*y))
else:
print(a*x + b* y)
|
p03371 | s042057465 | Accepted | a,b,c,x,y=map(int,input().split())
m=10**10
for i in range(2*(x+y)+1):
m=min(m,max(0,x-i//2)*a+max(0,y-i//2)*b+i*c)
print(m)
|
p03371 | s580641096 | Accepted | a,b,c,x,y = map(int, input().split())
c*=2
ans = min (a*x+b*y,c*max(x,y))
if x<y:
ans = min(c*x+(y-x)*b,ans)
else:
ans = min(c*y+(x-y)*a,ans)
print(ans)
|
p03371 | s381792058 | Accepted | A, B, C, X, Y = map(int, input().split())
if A + B > 2 * C:
a = min(X, Y)
c = a * 2 * C
if a == Y:
if A > 2 * C:
print(c + 2 * C * (X - a))
else:
print(c + (X - a) * A)
else:
if B > 2 * C:
print(c + 2 * C * (Y - a))
else:
print(c + (Y - a) * B)
else:
print(A * X + B * Y)
|
p03371 | s398309880 | Accepted | a, b, c, x, y = map(int, input().split())
if (a + b) / 2 < c:
print(a*x + b*y)
else:
ans = c * min(x, y) * 2
if x > y:
if a < c * 2:
ans += a * (x - y)
else:
ans += c * 2 * (x - y)
else:
if b < c * 2:
ans += b * (y - x)
else:
ans += c * 2 * (y - x)
print(ans) |
p03371 | s503234251 | Accepted | a,b,c,x,y = list(map(int, input().split()))
c = 2*c
ans = a * x + b *y
for i in range(1, max(x, y)+1):
_ans = c * i + a * max(x-i, 0) + b * max(y-i, 0)
ans = min(ans, _ans)
print(ans) |
p03371 | s630684450 | Accepted | A,B,C,X,Y=map(int,input().split())
if Y<X:
A,B=B,A
X,Y=Y,X
print(min(2*C,A+B)*X+min(2*C,B)*(Y-X))
|
p03371 | s347704590 | Accepted | a, b, c, x, y = map(int, input().split())
# 購入金額
price_a_b = 0
price_mix = 0
price_c = 0
# Aピザ、BピザをそれぞれX,Y枚購入する
price_a_b = a*x + b*y
# ABピザを、MIN(X,Y)*2枚購入し、Aピザ、Bピザどちらかの不足分を購入する
price_mix = c*min(x, y)*2 + a*(x-min(x, y)) + b*(y-min(x, y))
# ABピザをMAX(X,Y)枚購入する
price_c = c*max(x, y)*2
print(min(price_a_b, price_mix, price_c))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.