problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p03371 | s004803495 | Accepted | a,b,c,x,y = map(int,input().split())
ans = a*x+b*y
for i in range(10**5+1):
tmp = 2*c*i+max(0,x-i)*a+max(0,y-i)*b
ans = min(ans,tmp)
print(ans) |
p03371 | s267454570 | Accepted | import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
A, B, C, X, Y = i_l()
if X < Y:
X * C + (Y - X) * B
print(min((X * A + Y * B), (X * C * 2 + (Y - X) * B), C * max(X, Y) * 2))
else:
print(min((X * A + Y * B), (Y * C * 2 + (X - Y) * A), C * max(X, Y) * 2))
|
p03371 | s789132982 | Accepted | A,B,C,X,Y=map(int,input().split())
M=[A,B,C]
ans=[]
ans.append(A*X+B*Y)
ans.append(C*max(X,Y)*2)
if X>Y:
ans.append(C*min(X,Y)*2+A*(X-min(X,Y)))
if Y>X:
ans.append(C*min(X,Y)*2+B*(Y-min(X,Y)))
print(min(ans)) |
p03371 | s389306980 | Accepted | a, b, c, x, y = (int(x) for x in input().split())
ans = 10**18
ans = min(ans, a * x + b * y)
z = min(x, y)
ans = min(ans, 2 * c * z + a * (x - z) + b * (y - z))
ans = min(ans, 2 * c * max(x, y))
print(ans)
|
p03371 | s216525009 | Accepted | a, b, c, x, y = map(int, input().split())
minVal = c * 2 * (10 ** 5)
for i in range(10**5):
total = (c*2) * i + a * max(0, x-i) + b * max(0, y-i)
minVal = min(total, minVal)
print(minVal)
|
p03371 | s798231509 | Accepted | a,b,c,x,y=map(int,input().split())
aaa=[]
aaa.append(2*c*max([x,y]))
aaa.append(a*x+b*y)
if x > y:
aaa.append(2*c*y+a*(x-y))
elif x < y:
aaa.append(2*c*x+b*(y-x))
print(min(aaa)) |
p03371 | s451064602 | Accepted |
A,B,C,X,Y=map(int,input().split())
anslist=[]
for i in range(0,2*max(X,Y)+1,2):
ans=C*i
if X>i//2:
ans=ans+A*(X-i//2)
if Y>i//2:
ans=ans+B*(Y-i//2)
anslist.append(ans)
print(min(anslist))
|
p03371 | s080954549 | Accepted | A, B, C, X, Y = map(int, input().split())
if C*2 < A+B:
if X < Y:
print(min(C*2*X + (Y-X)*B, C*2*Y))
else:
print(min(C*2*Y + (X-Y)*A, C*2*X))
else:
print(A*X+B*Y)
|
p03371 | s349996161 | Accepted | A,B,C,X,Y = map(int,input().split())
if X<Y:
print(min(A*X+B*Y,Y*C*2,X*C*2+B*(Y-X)))
else:
print(min(A*X+B*Y,X*C*2,Y*C*2+A*(X-Y))) |
p03371 | s721228068 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for i in range(0, 2*max(X, Y)+1, 2):
ans = min(ans, int(A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i))
print(ans)
|
p03371 | s081702857 | Accepted | import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B, C, X, Y = map(int, readline().split())
ans = 10 ** 10
for c in range(2 * 10 ** 5 + 1):
a = X - c // 2
b = Y - c // 2
if a < 0:
a = 0
if b < 0:
b = 0
ans = min(ans, A * a + B * b + C * c)
print(ans)
|
p03371 | s714378404 | Accepted | A, B, C, X, Y = map(int, input().split())
C *= 2
if X == Y:
print(min(C * X, A * X + B * Y))
if X > Y:
print(min(C * X, C * Y + A * (X - Y), A * X + B * Y))
if X < Y:
print(min(C * Y, C * X + B * (Y - X), A * X + B * Y))
|
p03371 | s905451620 | Accepted | import math
a, b, c, x, y = map(int, input().split())
n = a*x + b*y
m = c*2*max(x,y)
min_xy = min(x,y)
k = min_xy*2*c + (x-min_xy)*a + (y-min_xy)*b
print(min(n,m,k)) |
p03371 | s581278666 | Accepted | A,B,C,X,Y=map(int,input().split())
ans=[A*X+B*Y,2*C*max(X,Y),2*Y*C+A*max(0,X-Y),2*X*C+B*max(0,Y-X)]
print(min(ans)) |
p03371 | s844106304 | Accepted | def main():
a,b,c,x,y = map(int, input().split())
ans = 10**10
for i in range(max(x, y)+1):
total = i*2*c + max(0, x-i)*a + max(0, y-i)*b
ans = min(ans, total)
print(ans)
if __name__ == '__main__':
main() |
p03371 | s914546567 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 0
if a+b >= c*2:
ans = min(x,y)*c*2
if x>y:
if a > c*2:
ans += c*2*(x-y)
else:
ans += a*(x-y)
else:
if b > c*2:
ans += c*2*(y-x)
else:
ans += b*(y-x)
else:
ans = a*x+b*y
print(ans) |
p03371 | s504573278 | Accepted | a, b, c, x, y = [int(i) for i in input().split()]
z = min(x, y)
money = 0
if a + b > c * 2:
money += z * c * 2
if x > y:
if a > c * 2:
money += (x - z) * c * 2
else:
money += (x - z) * a
else:
if b > c * 2:
money += (y - z) * c * 2
else:
money += (y - z) * b
else:
money += x * a + y * b
print(money) |
p03371 | s727020656 | Accepted | a, b, c, x, y = map(int, input().split())
cost1 = a * x + b * y
cost2 = c * max(x, y) * 2
if x < y:
cost3 = c * x * 2 + b * (y - x)
else:
cost3 = c * y * 2 + a * (x - y)
print(min(cost1, cost2, cost3)) |
p03371 | s871070263 | Accepted | A, B, C, x, y = list(map(int, input().split()))
cost = 1e+15
for i in range(max(x, y)+1):
xx = max(0, x - i)
yy = max(0, y - i)
cost = min(cost, A * xx + B * yy + 2*C*i)
print(cost)
|
p03371 | s627215620 | Accepted | def main():
a, b, c, x, y = map(int, input().split())
total_min = a * x + b * y
for i in range(1, max(x, y)+1):
total = a * max(x - i, 0) + b * max(y - i, 0) + c * i * 2
total_min = min(total, total_min)
print(total_min)
if __name__ == "__main__":
main() |
p03371 | s808820338 | Accepted | A,B,C,X,Y = map(int,input().split())
sumAB = A+B
if sumAB >= 2*C:
minXY = min(X,Y)
ans = min(X,Y)*2*C
X -= minXY
Y -= minXY
if X != 0:
ans += X*min(A,2*C)
elif Y !=0:
ans += Y*min(B,2*C)
print(ans)
else:
print(A*X+Y*B) |
p03371 | s442666086 | Accepted | a,b,c,x,y = map(int,input().split())
if (a + b) <= 2 * c:
print(a * x + b * y)
else:
max_c = max(x,y)
min_c = min(x,y)
AB = 2 * c * max_c
if x > y:
SP = ((x - min_c) * a) + (2 * c * min_c)
else:
SP = ((y - min_c) * b) + (2 * c * min_c)
print(min(AB,SP))
|
p03371 | s958441952 | Accepted | a, b, c, x, y = map(int, input().split())
if x < y:
a, b, x, y = b, a, y, x # x >= y
m1 = y * 2 * c + (x - y) * a
m2 = a * x + b * y
m3 = x * c * 2
print(min(m1, m2, m3)) |
p03371 | s796524359 | Accepted | A, B, C, X, Y = map(int, input().split())
if (A+B) <= 2*C:
print(A*X + B*Y)
else:
Z = 2 * min(X, Y)
X_rem = X - Z // 2
Y_rem = Y - Z // 2
if (X_rem != 0) and (A > 2*C):
print(C*(2*X))
elif (Y_rem != 0) and (B > 2*C):
print(C*(2*Y))
else:
print(A*X_rem + B*Y_rem + C*Z)
|
p03371 | s283226560 | Accepted | A,B,C,X,Y = map(int,input().split())
C *= 2
ax = 0
bx = 0
num = 0
while ax < X or bx < Y:
if ax < X and bx < Y:
if A+B < C:
num += A+B
else:
num += C
ax += 1
bx += 1
elif ax < X:
if A < C:
num += A
else:
num += C
ax += 1
else:
if B < C:
num += B
else:
num += C
bx += 1
print(num)
|
p03371 | s635570141 | Accepted | a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
for i in range(0, 2 * max(x, y) + 2, 2):
pay = max(0, (x - i / 2)) * a + max(0, (y - i / 2)) * b + c * i
ans = min(ans, pay)
print(int(ans))
|
p03371 | s293733678 | Accepted | a,b,c,x,y=map(int,input().split())
if a+b<=2*c: print(a*x+b*y)
else:
ans=min(x,y)*2*c
dif=abs(x-y)
if x>y:
if a>=2*c:
ans+=2*dif*c
else:
ans+=a*dif
else:
if b>=2*c:
ans+=2*dif*c
else:
ans+=b*dif
print(ans) |
p03371 | s038128022 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 0
if x > y:
a,b,x,y = b,a,y,x
if a + b >= 2 * c:
ans1 = 2 * c * x + b * (y - x)
ans2 = 2 * c * y
print(min(ans1,ans2))
else:
print(a*x + b*y) |
p03371 | s120961207 | Accepted | a,b,c,x,y = map(int,input().split())
amax = x*a
bmax = y*b
ans = amax+bmax
for _ in range(max(x,y)):
if x <= 0:
ans = min(ans-b+2*c,ans)
elif y <= 0:
ans = min(ans-a+2*c,ans)
else:
ans = min(ans-a-b+2*c,ans)
x-=1
y-=1
# print(x,y,ans)
print(ans) |
p03371 | s252965657 | Accepted | A, B, C, X, Y = map(int,input().split())
if A + B <= 2 * C:
ans = A * X + B * Y
elif 2 * C <= A and 2 * C <= B:
ans = 2 * C * max(X, Y)
elif 2 * C <= A:
ans = 2 * C * X + B * max(0, Y - X)
elif 2 * C <= B:
ans = 2 * C * Y + A * max(0, X - Y)
else:
if X < Y:
ans = 2 * C * X + B * (Y - X)
else:
ans = 2 * C * Y + A * (X - Y)
print(ans) |
p03371 | s190623381 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = X * A + Y * B
for nab in range(2, max(X, Y) * 2 + 2, 2):
price = nab * C
price += max(X - (nab // 2), 0) * A
price += max(Y - (nab // 2), 0) * B
ans = min(ans, price)
print(ans) |
p03371 | s820129357 | Accepted | #!/usr/bin/env python3
A, B, C, X, Y = map(int, input().split())
patterns = [0] * 4
patterns[0] = A * X + B * Y
patterns[1] = C * max(X, Y) * 2
patterns[2] = C * Y * 2 + A * (X - Y) if X > Y else float('inf')
patterns[3] = C * X * 2 + B * (Y - X) if X < Y else float('inf')
print(min(patterns))
|
p03371 | s507995766 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 10**18
for ab in range(max(X, Y) * 2 + 10):
a = max(0, X - ab // 2)
b = max(0, Y - ab // 2)
ans = min(ans, A * a + B * b + C * ab)
print(ans)
|
p03371 | s377839923 | Accepted | a, b, c, x, y = map(int, input().split())
# print(a, b, c, x, y)
ans = 10000 * (10 **5) + 7
c_max = 0
if x > y:
c_max = x * 2
else:
c_max = y * 2
for cc in range(0, c_max+1, 2):
ac = x - (cc // 2)
bc = y - (cc // 2)
if ac < 0:
ac = 0
if bc < 0:
bc = 0
price = ac * a + bc * b + cc * c
# print('price: {}, ac: {}, bc: {}, cc: {}'.format(price, ac, bc, cc))
ans = min(ans, price)
print(ans)
|
p03371 | s398608362 | Accepted | from numba import njit
@njit
def solve(a, b, c, x, y):
ans = 10000000000000000
for i in range(100000 + 1):
X = i * (2 * c) + max(0, x - i) * a + max(0, y - i) * b
ans = min(ans, X)
return ans
a, b, c, x, y = map(int, input().split())
print(solve(a, b, c, x, y))
|
p03371 | s567983204 | Accepted | A,B,C,X,Y,=map(int,input().split())
ans=10000000000000
for i in range(0,max(X,Y)+1):
ans=min(ans,2*i*C+max(0,X-i)*A+max(0,Y-i)*B)
print(ans)
|
p03371 | s632741660 | Accepted | a, b, c, x, y = map(int, input().split())
ans = x * a + y * b
for i in range(1, 10 ** 5 + 1):
ans = min(ans, max(x - i, 0) * a + max(y - i, 0) * b + i * 2 * c)
print(ans) |
p03371 | s533143706 | Accepted | def main():
A, B, C, X, Y = map(int, input().split())
ans = 10 ** 10
for k in range(10 ** 5 + 1):
total = 2 * C * k + A * max(0, X - k) + B * max(0, Y - k)
if total < ans:
ans = total
print(ans)
if __name__ == "__main__":
main()
|
p03371 | s486003661 | Accepted | A, B, C, X, Y = map(int, input().split())
AB = C
ans = 0
if 2*AB < A+B:
if X < Y:
ans += 2*AB * X
Y -= X
if 2*AB < B:
ans += 2*AB * Y
else:
ans += B*Y
else:
ans += 2*AB * Y
X -= Y
if 2*AB < A:
ans += 2*AB * X
else:
ans += A*X
else:
ans = A*X + B*Y
print(ans)
|
p03371 | s237948488 | Accepted | a,b,c,x,y = [int(i) for i in input().split()]
chk = []
if x>y:
chk.append(a*(x-y)+c*y*2)
chk.append(c*x*2)
else:
chk.append(b*(-x+y)+c*x*2)
chk.append(c*y*2)
chk.append(a*x+b*y)
chk.append(a*x+c*y*2)
chk.append(c*x*2+b*y)
print(min(chk)) |
p03371 | s559563458 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 0
if a+b<c*2:
ans = a*x+b*y
else:
if x>y:
ans = min(2*c*y+(x-y)*a, 2*c*x)
else:
ans = min(2*c*x+(y-x)*b, 2*c*y)
print(ans) |
p03371 | s311089697 | Accepted | #n = int(input())
a, b, c, x, y = map(int, input().split())
#al = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]
mn = a*x+b*y
for i in range(0, max(x, y)+1):
mn = min(mn, max(x-i, 0)*a+max(y-i, 0)*b+2*i*c)
print(mn)
|
p03371 | s564452677 | Accepted | A, B, C, X, Y = map(int, input().split())
a,b,ab = 0, 0, 0
a = X
b = Y
ab = 0
m = a * A + b * B + ab * C
big = max(X,Y)
while ab // 2 <= big:
ab += 2
if a > 0:
a -= 1
if b > 0:
b -= 1
m = min(m, a * A + b * B + ab * C)
print(m) |
p03371 | s375802187 | Accepted | a,b,c,x,y=map(int,input().split())
r=float('inf')
for i in range((10**5)+1):
r=min(r,i*2*c+max(0,x-i)*a+max(0,y-i)*b)
print(r) |
p03371 | s187687769 | Accepted | A, B, C, X, Y = list(map(int, input().split()))
s1 = A * X + B * Y
s2 = C * max(X, Y) * 2
if X > Y:
s3 = C * (Y * 2) + A * (X - Y)
elif Y > X:
s3 = C * (X * 2) + B * (Y - X)
else:
s3 = 10**10
print(min(s1, s2, s3)) |
p03371 | s669441308 | Accepted | a, b, c, x, y = map(int, input().split())
print(min(a*x+b*y, 2*c*x + b*max(0,y-x), 2*c*y + a*max(0, x-y))) |
p03371 | s442647556 | Accepted | a,b,c,x,y = map(int,input().split())
ans=a*x+b*y
if x>y:
e = c*2*y
f = a*(x-y)
ans=min(ans,e+f)
g= 2*c*x
ans=min(ans,g)
else:
e = c*2*x
f = b*(y-x)
ans = min(ans,e+f)
g = 2*c*y
ans = min(ans,g)
print(ans) |
p03371 | s295266667 | Accepted | import sys
input = sys.stdin.readline
def main():
ans = []
A, B, C, X, Y = map(int, input().split())
for i in range(10**5+1):
ans.append((C*2*i) + (A*max(0, X-i)) + (B*max(0, Y-i)))
print(min(ans))
if __name__ == '__main__':
main() |
p03371 | s099579948 | Accepted | a,b,c,x,y=map(int,input().split())
c*=2
d=a*x+b*y
f=max(x,y)*c
if x<y:
e=x*c+(y-x)*b
else:
z=x-y
e=y*c+(x-y)*a
print(min(d,min(e,f)))
|
p03371 | s738264125 | Accepted | A,B,C,x,y = map(int,input().split())
a = 0
b = 0
c = 0
if C*2 >= A + B:
print (A*x+B*y)
exit(0)
if C * 2 <= A and C * 2 <= B:
print (max(x,y) * 2 * C)
exit(0)
if x > y:
if A >= C * 2:
c = x * 2
else:
c = y * 2
a = (x-y)
else:
if B >= C * 2:
c = y * 2
else:
c = x * 2
b = (y-x)
print(A*a + B*b + C*c) |
p03371 | s328117087 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 0
if a + b > c * 2:
d = min(x, y)
ans += c * d * 2
x -= d
y -= d
if x > 0:
if a > c * 2:
ans += x * c * 2
else:
ans += x * a
if y > 0:
if b > c * 2:
ans += y * c * 2
else:
ans += y * b
print(ans)
|
p03371 | s012601300 | Accepted | a, b, c, x, y = map(int, input().split())
num = min(a + b, c * 2)
a = min(a, c * 2)
b = min(b, c * 2)
s = min(x, y)
if x > y:
print(num * s + a * (x - s))
else:
print(num * s + b * (y - s))
|
p03371 | s837039373 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 0
if c*2 < a+b:
ans += min(x, y) * c * 2
if x > y:
ans += min(a, 2*c) * abs(x-y)
elif x < y:
ans += min(b, 2*c) * abs(x-y)
else:
ans += a * x + b * y
print(ans) |
p03371 | s653569597 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(10**5 + 1):
price = 2*C*i + A*max(0, X - i) + B*max(0, Y - i)
if ans > price:
ans = price
print(ans) |
p03371 | s787854099 | Accepted | a,b,c,x,y=map(int,input().split())
ans1=x*a+y*b
if x>=y:
ans2=2*y*c+(x-y)*a#(x,y)=(3,2)であればABを4枚買う
else:
ans2=2*x*c+(y-x)*b
ans3=2*max(x,y)*c
print(min(ans1,ans2,ans3)) |
p03371 | s839212731 | Accepted | A,B,C,X,Y = map(int,input().split())
if A+B <= 2*C:
ans = A*X+B*Y
elif (A <= 2*C and X>=Y) or (B <= 2*C and X <= Y):
minAB = min(X,Y)
ans = 2*C*minAB+(X-minAB)*A+(Y-minAB)*B
else:
ans = 2*C*max(X,Y)
print(ans) |
p03371 | s594956293 | Accepted | #「ABピザを買う枚数」で全探索
A,B,C,X,Y = map(int,input().split())
ans = float("inf")
for i in range(0,2*max(X,Y)+1,1):#「ABピザを買う枚数」で全探索
tmpans = i*C#ABピザの代金
tmp_x = max(0,X-i//2)
tmp_y = max(0,Y-i//2)
tmpans += A*tmp_x
tmpans += B*tmp_y
ans = min(ans,tmpans)
print(ans) |
p03371 | s491958684 | Accepted | a, b, c, x, y = map(int,input().split())
ans = 10**18
for i in range(100100):
ans = min(ans, 2*c*i + max(0, x-i)*a + max(0,y-i)*b)
print(ans) |
p03371 | s862871461 | Accepted | import numpy as np
def f(a, b, c, x, y):
Min = np.inf
for use_c in range(max(x, y) * 2 + 1):
price = use_c * c + max(0, x - use_c // 2) * a + max(0, y - use_c // 2) * b
if price < Min:
Min = price
print(Min)
a, b, c, x, y = map(int, input().split())
f(a, b, c, x, y)
|
p03371 | s986056967 | Accepted | A, B, C, X, Y = map(int, input().split())
C *= 2
if X == Y:
print(min(C * X, A * X + B * Y))
if X > Y:
print(min(C * X, C * Y + A * (X - Y), A * X + B * Y))
if X < Y:
print(min(C * Y, C * X + B * (Y - X), A * X + B * Y))
|
p03371 | s301713436 | Accepted | a,b,c,x,y=map(int,input().split())
ans=10**9
for i in range(max(x,y)+1):
ans=min(ans,i*2*c+max(0,x-i)*a+max(0,y-i)*b)
print(ans) |
p03371 | s851258160 | Accepted | A, B, C, X, Y = map(int, input().split())
C = min(2*C, A+B)
ans = 0
ans += C*min(X, Y)
if X > Y:
ans += min(C, A) * abs(X-Y)
else:
ans += min(C, B) * abs(X-Y)
print(ans)
|
p03371 | s720466490 | Accepted | A, B, C, X, Y = map(int, input().split())
if X >= Y:
ans = min(A*X + B*Y, 2*C*Y + A*(X-Y), 2*C*X)
else:
ans = min(A*X + B*Y, 2*C*X + B*(Y-X), 2*C*Y)
print(ans) |
p03371 | s520100840 | Accepted | a,b,c,x,y=map(int,input().split())
mi=min([x,y])
ma=max([x,y])
g=ma-mi
ans,ab=0,0
if 2*c <= a+b:
if x>=y:
ans+=2*c*y + (x-y)*a
ab=2*c*x
else:
ans+=2*c*x + (y-x)*b
ab=2*c*y
else:
ans+=a*x+b*y
if ab >= ans:
print(ans)
else:
if ab!=0:
print(ab)
else:
print(ans)
|
p03371 | s015283681 | Accepted | A,B,C,X,Y = map(int,(input().split()))
#ABピザの最大枚数
limit = max(X,Y)*2
Min = 10**10
for i in range(limit+1):
a=0
b=0
c=0
if i/2 < X:
a = (X-int(i/2)) *A
if i/2 < Y:
b= (Y-int(i/2))*B
c = i*C
Min = min(Min,a+b+c)
print(Min)
|
p03371 | s840388734 | Accepted | a, b, c, x, y = map(int, input().split())
if x>=y:
print(min(a*x+b*y, c*x*2, c*y*2+a*(x-y)))
elif x<y:
print(min(a*x+b*y, c*y*2, c*x*2+b*(y-x))) |
p03371 | s112218059 | Accepted | #!/usr/bin/env python3
def main():
A, B, C, X, Y = map(int, open(0).read().split())
S = []
for i in range(0, 2*max(X, Y)+1):
S.append(A*max(0, X - i//2) + B*max(0, Y - i//2) + C*i)
print(min(S))
main() |
p03371 | s821199008 | Accepted | a,b,c,x,y = map(int, input().split())
ans1 = c*max(x,y)*2
ans2 = a*x + b*y
if x<y:
ans3 = c*2*x + b*(y-x)
else:
ans3 = c*2*y + a*(x-y)
print(min(ans1,ans2,ans3))
|
p03371 | s460195964 | Accepted | A, B, C, X, Y = map(int, input().split(" "))
prices = []
if X > Y:
half_max_count = X + 1
else:
half_max_count = Y + 1
# 3 for文はダメなので削減する
# sliceで半分にできる多分。
for i in range(0, half_max_count):
a_price = int(X - i) * A if (int(X - i) >= 0) else 0
b_price = int(Y - i) * B if (int(Y - i) >= 0) else 0
half_price = 2 * i * C
price = half_price + a_price + b_price
prices.append(price)
print(min(prices))
|
p03371 | s761804939 | 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=C*2*X
if 2*C<=B:
ans+=2*C*(Y-X)
else:
ans+=B*(Y-X)
else:
ans=C*2*Y
if 2*C<=A:
ans+=2*C*(X-Y)
else:
ans+=A*(X-Y)
print(ans) |
p03371 | s698542381 | Accepted | a, b, ab, x, y = map(int, input().split())
min_value = a * x + b * y
max_num = max(x, y)
for i in range(2, max_num * 2 + 1, 2):
# print(i)
value = ab * i + a * max(0, x - i // 2) + b * max(0, y - i // 2)
# print(value)
min_value = min(min_value, value)
print(min_value)
|
p03371 | s741783167 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(10**5 + 1):
price = 2*C*i + A*max(0, X - i) + B*max(0, Y - i)
if ans > price:
ans = price
print(ans) |
p03371 | s922088537 | Accepted | def half_and_half(a,b,c,x,y):
z = x if x > y else y
can = []
for n in range(z+1):
p = x - n if x > n else 0
q = y - n if y > n else 0
amount = p*a + q*b + n*c*2
#print("%d = %d x %d + %d x %d + %d x %d " %(amount,p,a,q,b,n,c))
can.append(amount)
return min(can)
if __name__ == '__main__':
a,b,c,x,y = map(int,input().split())
print(half_and_half(a,b,c,x,y))
|
p03371 | s887749625 | Accepted | a,b,c,x,y = map(int,input().split())
if a+b > 2*c:
if x <= y:
ans = x*c*2 + (y-x)*min(b,2*c)
elif y < x:
ans = y*c*2 + (x-y)*min(a,2*c)
else:
ans = x*a + y*b
print(ans) |
p03371 | s995040868 | Accepted | A,B,C,X,Y = map(int,input().split())
moneys = []
for i in range(0,2*max(X,Y)+1,2):
if X-i//2 >= 0 and Y-i//2 >= 0:
moneys.append((X-i//2)*A + (Y-i//2)*B + C*i)
elif X-i//2 >= 0 and Y-i//2 < 0:
moneys.append((X-i//2)*A + C*i)
elif X-i//2 < 0 and Y-i//2 >= 0:
moneys.append((Y-i//2)*B + C*i)
else:
moneys.append(C*i)
print(min(moneys)) |
p03371 | s871637592 | Accepted | a,b,c,X,Y=map(int,input().split())
s=min(X,Y)
t=max(X,Y)
ans1=2*c*s+a*(X-s)+b*(Y-s)
ans2=a*X+b*Y
ans3=2*c*t
print(min(ans1,ans2,ans3))
|
p03371 | s343042050 | Accepted | a,b,c,x,y = map(int,input().split())
l = 0
flg = x
if x > y:
l += (x - y) * a
flg = y
elif x < y:
l += (y - x) * b
else:
pass
l += flg * 2 * c
n = max(x,y) * 2 * c
m = x * a + y * b
print(min(l,n,m)) |
p03371 | s168027380 | Accepted | a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
print(a*x+b*y)
else:
if x>=y:
total=y*2*c
if a*(x-y)>=2*c*(x-y):
total+=2*c*(x-y)
else:
total+=a*(x-y)
else:
total=x*2*c
if b*(y-x)>=c*2*(y-x):
total+=2*c*(y-x)
else:
total+=b*(y-x)
print(total) |
p03371 | s901918125 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 0
min_ = min(x, y)
res = abs(x-y)
if a+b < 2*c:
ans += min_*(a+b)
else:
ans += min_*2*c
if x>y and res*a < res*2*c:
ans += res*a
elif x<y and res*b < res*2*c:
ans += res*b
else:
ans += res*2*c
print(ans) |
p03371 | s865165525 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 0
if a+b>2*c:
if x>y:
ans = min(c*2*x,c*y*2+(x-y)*a)
else:
ans = min(c*2*y,c*x*2+(y-x)*b)
else:
ans = a*x + b*y
print(ans) |
p03371 | s686316071 | Accepted | a, b, c, x, y = map(int, input().split())
k = min(x, y)
ans = 0
if a + b >= 2 * c:
ans += 2 * k * c
if x >= y:
ans += min((x - k) * a, 2 * c * (x - k))
elif x < y:
ans += min((y - k) * b, 2 * c * (y - k))
else:
ans += x * a + y * b
print(ans) |
p03371 | s609318003 | Accepted | A, B, C, X, Y = list(map(int, input().split()))
ans = A*X + B*Y
c = min(X, Y)
ans = min(A*(X-c) + B*(Y-c) + c*C*2, ans)
c = max(X, Y)
ans = min(c*C*2, ans)
print(ans) |
p03371 | s434969192 | Accepted | 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) * min(A, 2 * C)
else:
ans += (Y - X) * min(B, 2 * C)
else:
ans = X * A + Y * B
print(ans)
|
p03371 | s293227453 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 10 ** 9
for cn in range(0, max(x, y) * 2 + 1, 2):
may = max(0, x - cn // 2) * a + max(0, y - cn // 2) * b + cn * c
ans = min(ans, may)
print(ans)
|
p03371 | s223988235 | Accepted | A,B,C,X,Y = map(int,input().split())
min_xy = min(X,Y)
max_xy = max(X,Y)
ans1 = 2 * C * min_xy + A * (X-min_xy) + B * (Y-min_xy) # 無駄にならない範囲でABピザを買い、残りを買う
ans2 = A*X + B*Y # ABピザを買わない
ans3 = 2 * C * max_xy # ABピザだけを買う
print (min(ans1,ans2,ans3)) |
p03371 | s672032463 | Accepted | def solve(a,b,c,x,y):
l = []
for i in range(10**6):
s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
l.append(s)
return min(l)
A,B,C,X,Y = map(int,input().split())
print(solve(A,B,C,X,Y))
|
p03371 | s176387936 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 1000000007
for i in range(max(X, Y) + 1):
i_C = 2 * i
i_A = max(0, X - i)
i_B = max(0, Y - i)
#
ans = min(ans, A * i_A + B * i_B + C * i_C)
print(ans)
|
p03371 | s839087759 | Accepted | #n=int(input())
a,b,c,x,y=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=a*x+b*y
for i in range(1,max(x,y)+1):
ans=min(ans,2*c*i+a*max(x-i,0)+b*max(y-i,0))
print(ans)
|
p03371 | s955026228 | Accepted | def main():
a, b, c, x, y = map(int, input().split())
ans = 1000000007
for i in range(100001):
cost = c * i * 2 + a * max(0, x - i) + b * max(0, y - i)
if cost < ans:
ans = cost
print(ans)
if __name__ == '__main__':
main()
|
p03371 | s499888283 | Accepted | a, b , c, x, y = map(int, input().split())
s = set()
s.add(a*x + b*y)
if x < y:
s.add(2*x*c + b*(y-x))
s.add(2*(x+1)*c + b*(y-x-1))
s.add(2*y*c)
print(min(s))
else:
s.add(2*y*c + a*(x-y))
s.add(2*(y+1)*c + a*(x-y-1))
s.add(2*x*c)
print(min(s)) |
p03371 | s119167634 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 5000*(10**5)*2
for i in range(max(x, y)+1):
tmp_ans = i*2*c
if x > i:
tmp_ans += (x-i)*a
if y > i:
tmp_ans += (y-i)*b
ans = min(ans, tmp_ans)
print(ans)
|
p03371 | s326883898 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for c_2 in range(10**5 + 1):
a = max(X - c_2, 0)
b = max(Y - c_2, 0)
ans = min(ans, a * A + b * B + c_2 * C * 2)
print(ans) |
p03371 | s172231832 | Accepted | A, B, C, X, Y = map(int, input().split())
all = A * X + B * Y
all_half = max(X, Y) * C * 2
m = min(X, Y)
appropriate_half = (m * C * 2) + A * (X - m) + B * (Y - m)
print(min(all, all_half, appropriate_half)) |
p03371 | s170854328 | Accepted | a,b,c,x,y = map(int,input().split())
res = 9999999999999
for i in range(0, 200002, 2):
na = x - i//2
nb = y - i//2
na = 0 if na < 0 else na
nb = 0 if nb < 0 else nb
res = min(res, c * i + a*na + b*nb)
print(res) |
p03371 | s015018251 | Accepted | a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
ans = min(c * max(x, y) * 2, ans)
if x < y:
ans = min(c * x * 2 + (y - x) * b, ans)
else:
ans = min(c * y * 2 + (x - y) * a, ans)
print(ans) |
p03371 | s784821150 | Accepted | a,b,c,x,y = map(int,input().split())
# print(a,b,c,x,y)
#Cについての全列挙する
v1 = max(x*2,y*2)*c
v2 = a*x+b*y
v3=120000*100000
for i in range(max(x,y)+1):
c_sum = c*2*(i)
if x > i:
c_sum += a*(x-i)
if y > i:
c_sum += b*(y-i)
if c_sum < v3:
v3 = c_sum
# print(c_sum)
# print(v1,v2,v3)
print(min(v1,v2,v3))
|
p03371 | s877105956 | Accepted | a, b, c, x, y = map(int, input().split())
i = a*x+b*y
j = c*min(x, y)*2+a*(x-min(x, y))+b*(y-min(x, y))
k = c*max(x, y)*2
print(min(i, j, k))
|
p03371 | s058926350 | Accepted | def main():
A, B, C, X, Y = map(int, input().split())
ans = 1 << 30
c = 0 # even
while True:
j = c // 2
t = A * max(0, X - j) + B * max(0, Y - j) + C * c
if ans <= t: break
ans = t
c += 2
print(ans)
if __name__ == '__main__':
main()
|
p03371 | s116073918 | Accepted | a, b, c, x, y = map(int, input().split())
total = 0
if x >= y:
total = min(a*x+b*y, c*x*2, c*y*2+a*(x-y))
else:
total = min(a*x+b*y, c*y*2, c*x*2+b*(y-x))
print(total) |
p03371 | s393455309 | Accepted | a, b, c, x, y=map(int,input().split())
cnt = 10**9
for m in range(max(x,y)+1):
price = (2*m*c) + max(0,(x-m))*a + max(0,y-m)*b
cnt = min(cnt, price)
print(cnt) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.