problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03371
s751989384
Accepted
A,B,C,X,Y = map(int,input().split()) if A + B <= 2 * C: print(X*A+Y*B) else: if X >= Y: if A >= 2*C: print(2*X*C) else: print((X-Y)*A + 2*Y*C) else: if B >= 2*C: print(2*Y*C) else: print((Y-X)*B + 2*X*C)
p03371
s296762278
Accepted
a, b, c, x, y = map(int, input().split()) if a+b <= 2*c: print(a*x + b*y) else: if x > y: if a < 2*c: print(2*y*c + (x-y)*a) else: print(2*x*c) else: if b < 2*c: print(2*x*c + (y-x)*b) else: print(2*y*c)
p03371
s394399016
Accepted
A, B, C, X, Y = map(int,input().split()) if A + B < 2 * C: print(A * X + B * Y) elif min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y else B) > (max(X , Y) * 2 * C): print(max(X , Y) * 2 * C) else: print(min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y else B) )
p03371
s856608037
Accepted
a, b, c, x, y = map(int, input().split()) ans = 10 ** 50 for i in range(10 ** 5 + 1): ans = min(ans, (2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b)) print(ans)
p03371
s496360267
Accepted
l = list(map(int, input().split())) A, B, C, X, Y = l[0], l[1], l[2], l[3], l[4] s_1, s_2, s_3 = 0, 0, 0 s_1 = A*X + B*Y maxv = max([X, Y]) s_2 = 2*C*max([X, Y]) if X >= Y: s_3 = 2*C*Y + A*(X-Y) else: s_3 = 2*C*X + B*(Y-X) print(min([s_1, s_2, s_3]))
p03371
s373367912
Accepted
a,b,c,x,y = map(int,input().split()) cx,cy = 0,0 ans = 0 a1 = a*x+b*y if x<y: a2 = 2*c*x + b*(y-x) else: a2 = 2*c*y + a*abs(y-x) a3 = c*max(x,y)*2 print(min([a1,a2,a3]))
p03371
s454354567
Accepted
A,B,C,X,Y=map(int,input().split()) tmp0 = X*A + Y*B tmp1 = max(X,Y)*2*C if X>Y: tmp2 = Y*2*C + (X-Y)*A else: tmp2 = X*2*C + (Y-X)*B print(min(tmp0,tmp1,tmp2))
p03371
s189677935
Accepted
A,B,C,X,Y=map(int,input().split()) a=A*X+B*Y b=max(X,Y)*C*2 p=B if X<Y else A c=min(X,Y)*2*C+abs(X-Y)*p print(min(a,b,c))
p03371
s143813159
Accepted
A,B,C,X,Y = map(int,input().split()) C*=2 ans = min(X*A+Y*B,C*max(X,Y)) ans = min(X*C+max(0,Y-X)*B,Y*C+max(0,X-Y)*A,ans) print(ans)
p03371
s728983838
Accepted
A, B, C, X, Y = map(int, input().split()) import math saishou = math.inf temp = 0 for i in range (0, X+1): temp = A*i+C*2*(X-i) if X-i < Y: if 2*C <= B: temp+=2*C*(Y-(X-i)) else: temp+=B*(Y-(X-i)) if saishou > temp: saishou = temp print(saishou)
p03371
s103268831
Accepted
def main(): A, B, C, X, Y = map(int, input().split()) ans = 10**10 max_c = max(X, Y) + 1 for i in range(max_c): num_c = i * 2 num_a = max(0, X - i) num_b = max(0, Y - i) price = num_a * A + num_b * B + num_c * C ans = min(price, ans) print(ans) if __name__ == '__main__': main()
p03371
s542349967
Accepted
def main(): a, b, c, x, y = map(int, input().split()) xyK = min(x, y) k = min(a + b, c * 2) * xyK x -= xyK y -= xyK print(k + x * min(a, c * 2) + y * min(b, c * 2)) if __name__ == '__main__': main()
p03371
s589081021
Accepted
A, B, C, X, Y = map(int, input().split()) a = A * X + B * Y b = C * max(X, Y) * 2 c = A * (X - Y) + 2 * C * Y d = B * (Y - X) + 2 * C * X e = max(c, d) ans = min(a, b, e) print(ans)
p03371
s030272732
Accepted
a,b,c,x,y = list(map(int, input().split())) if a + b < 2*c : print(x*a + y*b) else : if x >= y : if a >= 2*c: print(y*2*c + (x-y)*2*c) else : print(y*2*c + (x-y)*a) else : if b >= 2*c: print(x*2*c + (y-x)*2*c) else: print(x*2*c + (y-x)*b)
p03371
s695069255
Accepted
a, b, c, x, y = map(int, input().split()) if x < y: big_num = y small_num = x big_price = b #small_price = a else: big_num = x small_num = y big_price = a #small_price = b ans = 0 ans += min(a + b, 2 * c) * small_num ans += min(big_price, 2 * c) * (big_num - small_num) print(ans)
p03371
s785488691
Accepted
a,b,c,x,y = map(int, input().split()) plan_a = c * (2*x) + max(0, y-x) * b plan_b = c * (2*y) + max(0, x-y) * a plan_c = a * x + b * y print(min(plan_a, plan_b, plan_c))
p03371
s793871151
Accepted
def LI():return map(int,input().split()) def I(): return input().split() a,b,c,x,y=LI() lst=[] ans=0 for i in range(10**5+1): lst.append(2*i*c+max(0,x-i)*a+max(0,y-i)*b) print(min(lst))
p03371
s105510214
Accepted
a, b, c, x, y = map(int, input().split()) ans = 10**9 for i in range(0, 10**5+1): cost = 2*c*i + a*max(0, x-i) + b*max(0, y-i) ans = min(cost, ans) print(ans)
p03371
s540333839
Accepted
a, b, c, x, y = map(int, input().split()) c *= 2 t = 0 if a+b > c: v = min([x,y]) t = v * c x, y = x-v, y-v if x>0: if a<c: t = t + a*x else: t = t + c*x elif y>0: if b<c: t = t + b*y else: t = t + c*y else: t = a*x + b*y print(t)
p03371
s940378474
Accepted
a,b,c,x,y = map(int,input().split()) atob = x*a + y*b maxab = (max(x,y) * 2) * c if x > y: minab = y*c*2 + (x-y)*a else: minab = x*c*2 + (y-x)*b print(min(atob,maxab,minab))
p03371
s025524900
Accepted
a, b, c, x, y = map(int,input().split()) price = a * x + b * y for i in range(max(x,y)+1): new_price = c * 2 * i + max(a * (x - i),0) + max(b * (y - i),0) price = min(price,new_price) print(price)
p03371
s891648217
Accepted
a,b,c,x,y = map(int,input().split()) ans = min(a*x+b*y, c*x*2+b*max(0, y-x), a*max(0, x-y)+c*y*2) print(ans)
p03371
s152902477
Accepted
A,B,C,X,Y = map(int,input().split()) # あり得るのはすべてA,Bで買う.少ない方を満たすまで import math max_money = A*X + B*Y # 次にAをすべて!ABで買ってみる if X>Y: max_money = min(2*X*C,max_money) else: max_money = min(max_money,2*X*C + (Y-X)*B) # 次にBをすべて!ABで買ってみる if Y>X: max_money = min(2*Y*C,max_money) else: max_money = min(max_money,2*Y*C + (X-Y)*A) print(max_money)
p03371
s953579777
Accepted
a,b,c,x,y=map(int, input().split()) z = 0#xy l= [] l.append(a * x+b * y) while x > 0 or y > 0: x -= 1 y -= 1 z += 2 x1 = x if x1 < 0: x1 = 0 y1 = y if y1 < 0: y1 = 0 l.append(a * x1 + y1 * b + z * c) print(min(l))
p03371
s464044436
Accepted
a,b,c,x,y=map(int,input().split()) ans=float('inf') for i in range(10**5+1): tmp=2*i*c+a*max(x-i,0)+b*max(y-i,0) ans=min(tmp,ans) print(ans)
p03371
s546566286
Accepted
#!/usr/bin/env python3 a, b, c, x, y = map(int, input().split()) ans = a * x + b * y for i in range(1, max(x, y) + 1): d = a * max(0, (x - i)) + b * max(0, (y - i)) + (c * 2) * i ans = min(ans, d) print(ans)
p03371
s748774648
Accepted
A,B,C_AB,X,Y = map(int, input().split()) if A+B >= 2*C_AB: print(2*C_AB*(min(X,Y)) + min(A,2*C_AB)*(X-min(X,Y)) + min(B,2*C_AB)*(Y-min(X,Y))) else: print(A*X+ B*Y)
p03371
s328845080
Accepted
import sys a, b, c, x, y = map(int, input().split()) ans=sys.maxsize for i in range(max(x,y)+1): temp=2*c*i if x-i>0: temp+=a*(x-i) if y-i>0: temp+=b*(y-i) ans=min(ans,temp) print(ans)
p03371
s567365680
Accepted
a, b, c, x, y = map(int, input().split()) c = 2 * c ans = 1001001001 for i in range(max(x, y) + 1): tmp = a * max(0, x - i) + b * max(0, y - i) + c * i ans = min(ans, tmp) print(ans)
p03371
s208344914
Accepted
A, B, C, X, Y = map(int, input().split()) # ans = float('inf') # for i in range(10 ** 5 + 1): # ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i) # print(ans) min_xy = min(X, Y) max_xy = max(X, Y) ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy) ans2 = A * X + B * Y ans3 = 2 * C * max_xy print(min(ans1, ans2, ans3))
p03371
s570342027
Accepted
A, B, C, X, Y = map(int, input().split()) a1 = A * X + B * Y a2 = B * (Y - X) + C * 2 * X a3 = A * (X - Y) + C * 2 * Y a4 = a3 if X > Y else a2 a5 = C * 2 * max(X, Y) ans = min(a1, a4, a5) print(ans)
p03371
s906285296
Accepted
#Order can be reduced by diving cases but full search on purpose a, b, c, x, y = map(int, input().split()) num = float("inf") for i in range(max(x, y) + 1): num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i) print(num)
p03371
s529018075
Accepted
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 += (X-Y) * min(2*C, A) else: ans += (Y-X) *min(2*C, B) else: ans = A * X + B* Y print(ans)
p03371
s366320664
Accepted
A,B,C,X,Y=map(int, input().split()) res = float('inf') for i in range(max(2*X,2*Y)+1): tmp = 2*i*C + max(0,X-i)*A + max(0,Y-i)*B res = min(res, tmp) print(res)
p03371
s926422408
Accepted
a, b, c, x, y = map(int, input().split()) p1 = a * x + b * y # A>C p = c * 2 * x if x >= y: p = p else: p = p + (y - x) * b # B>C p2 = c * 2 * y if x >= y: p2 = p2 + (x - y) * a else: p2 =p2 print(min(p, p1, p2))
p03371
s828336989
Accepted
A, B, C, X, Y = map(int, input().split()) p1 = 2 * C * min(X, Y) + A * (X - min(X, Y)) + B * (Y - min(X, Y)) p2 = 2 * C * max(X, Y) p3 = A * X + B * Y print(min(p1, p2, p3))
p03371
s728736040
Accepted
pa, pb, pab, x, y = map(int, input().split()) li = [] if x-y>= 0: li.append(pa*x+pb*y) li.append(pa*(x-y)+pab*2*y) li.append(pab*2*x) if y-x>= 0: li.append(pa*x+pb*y) li.append(pb*(y-x)+pab*2*x) li.append(pab*2*y) li.sort() print(li[0])
p03371
s846693893
Accepted
a,b,c,x,y = map(int,input().split()) if a+b > c*2: mmm = min(x,y) aaa = max(x,y) if (x > y and a<=2*c): print(c*2*mmm + a*(aaa-mmm)) elif (x > y and a>2*c): print(c*2*aaa) elif (x <= y and b<=2*c): print(c*2*mmm + b*(aaa-mmm)) elif (x <= y and b>2*c): print(c*2*aaa) else: print(a*x + b*y)
p03371
s009370008
Accepted
A,B,C,X,Y = map(int,input().split()) a = min(X,Y) b = max(X,Y) if A+B>=2*C: ans = a*2*C if X>=Y: ans += (X-Y)*min(A,2*C) else: ans += (Y-X)*min(B,2*C) else: ans = A*X+B*Y print(ans)
p03371
s537618501
Accepted
a,b,c,x,y=map(int,input().split()) yenmin=a*x+b*y for zz in range(2*10**5+1): xx=max(x-zz//2,0) yy=max(y-zz//2,0) yen=a*xx+b*yy+c*zz if yen<yenmin: yenmin=yen print(yenmin) #print(xx,yy,zz)
p03371
s541763160
Accepted
a, b, c, x, y = list(map(int, input().split(' '))) d = c * 2 ans = 1 << 30 # ABを何枚 for i in range(max(x, y) + 1): rx = max(x - i, 0) ry = max(y - i, 0) ans = min(ans, i * d + rx * a + ry * b) print(ans)
p03371
s072896899
Accepted
import sys readline = sys.stdin.buffer.readline def main(): A, B, C, X, Y = map(int, readline().rstrip().split()) if A + B <= 2 * C: print(X * A + Y * B) return m = min(X, Y) ans = m * 2 * C X -= m Y -= m ans += min(X * A + Y * B, max(X, Y) * 2 * C) print(ans) if __name__ == '__main__': main()
p03371
s525101838
Accepted
# C - Half and Half A, B, C, X, Y = map(int, input().split()) # 条件を満たすときのA, B, ABの買い方を全列挙したい # A, Bの枚数は、ABの値が決まれば、一意に定まるため、 # ABのみループする。 ans = 10**18 for i in range(0, max(X, Y)*2+1, 2): x = max(X-i//2, 0) y = max(Y-i//2, 0) ans = min(ans, x*A + y*B + i*C) print(ans)
p03371
s494937531
Accepted
a,b,c,x,y = map(int, input().split()) cost = {x:a, y:b} s = min(x,y) * c * 2 + abs(x - y) * cost[max(x,y)] t = max(x,y) * c * 2 u = a * x + b * y print(min([s, t, u]))
p03371
s009318123
Accepted
A,B,C,X,Y = map(int, input().split()) if X <= Y: S = B Z = X W = Y else: S = A Z = Y W = X if 2*C > A+B: print(A*X+B*Y) elif 2*C > S: print((2*C-S)*Z + S*W) else: print(2*C*W)
p03371
s084478934
Accepted
A, B, C, X, Y = map(int,input().split()) if A + B < 2 * C: print(A * X + B * Y) elif min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y else B) > (max(X , Y) * 2 * C): print(max(X , Y) * 2 * C) else: print(min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y else B) )
p03371
s936016884
Accepted
a, b, c, x, y =map(int, input().split()) ab = 2*c i = 0 cost = 0 minCost = 10**10 while i < 10**6: cost = i*ab cost += a *(max(0, (x-i))) cost += b *(max(0, (y-i))) if minCost >= cost: minCost = cost i += 1 print(minCost)
p03371
s506128549
Accepted
A,B,C,X,Y = map(int,input().split()) ans = float("inf") for i in range(0,2*max(X,Y)+2,2): yen = A*max(0,X-(i//2))+C*i+B*max(0,Y-(i//2)) ans = min(ans,yen) print(ans)
p03371
s780235198
Accepted
A,B,C,X,Y = map(int,input().split()) z = max(X,Y)*2 act_list = [] for i in range(0,z+1,2): x = int(X - i*0.5) y = int(Y - i*0.5) if x <= 0: x = 0 if y <= 0: y = 0 act = x * A + y * B + i * C act_list.append(act) print(min(act_list))
p03371
s259492675
Accepted
a,b,c,x,y = map(int, input().split()) if 2*c < a+b: if x < y: ans = 2*c * x + min(2*c, b) * (y - x) else: ans = 2*c * y + min(2*c, a) * (x - y) else: ans = a * x + b * y print(ans)
p03371
s601717074
Accepted
A, B, C, X, Y = map(int,input().split()) import math price_min = -1 for ab in [0, 2*X, 2*Y]: X_need = X - 0.5*ab Y_need = Y - 0.5*ab if X_need < 0: X_need = 0 if Y_need < 0: Y_need = 0 price = ab * C + A * math.ceil(X_need) + B * math.ceil(Y_need) if price_min == -1: price_min = price else: price_min = min(price, price_min) print(price_min)
p03371
s003671004
Accepted
A,B,C,X,Y = (int(i) for i in input().split()) AB_optimal = min(A+B, C*2) A_optimal = min(A,C*2) B_optimal = min(B,C*2) XY_diff = abs(X-Y) ans = 0 if X>=Y: ans += (X-XY_diff) * AB_optimal ans += XY_diff * A_optimal else: ans += (Y-XY_diff) * AB_optimal ans += XY_diff * B_optimal print(ans)
p03371
s976039758
Accepted
a,b,c,x,y = map(int,input().split()) ans = 0 if 2*c <= a+b: m = min(x,y) x -= m y -= m ans += m*2*c ans += min(a,2*c)*x+min(b,2*c)*y print(ans) else: print(a*x+b*y)
p03371
s292659977
Accepted
A,B,C,X,Y = map(int,input().split()) ans = 0 if A + B < C * 2: ans = A * X + B* Y else: ans = min(X,Y) * C * 2 x = min(X,Y) X -= x Y -= x ans += min(X * A + Y * B,X * C * 2+ Y * C * 2) print(ans)
p03371
s656913980
Accepted
# coding: utf-8 A, B, C, X, Y = map(int, input().split(" ")) n = 10 ** 10 min_a = min_b = min_c = 10**10 max_ab = 0 for ab in range(0, 2*max(X, Y) + 2, 2): a = max(X - ab//2, 0) b = max(Y - ab//2, 0) n = min(n, a*A + b*B + ab*C) print(n)
p03371
s511943746
Accepted
A, B, C, X, Y = map(int,input().split()) def best_pizza_cost(ln, hn): if ln == X: lp = A else: lp = B if hn == Y: hp = B else: hp = A fnp = lp * ln + hp * ln fhp = C * ln * 2 left = hn-ln snp = hp * left shp = C * left * 2 #print(fnp, fhp, snp, shp) return min(fnp, fhp) + min(snp, shp) print(best_pizza_cost(min(X, Y), max(X, Y)))
p03371
s749242988
Accepted
a,b,c,x,y = map(int,input().split()) print(min(a*x+b*y,2*c*min(x,y)+abs(x-y)*(a if max(x,y)==x else b),2*c*min(x,y)+abs(x-y)*2*c))
p03371
s728816466
Accepted
a,b,c,x,y = map(int,input().split()) n = a*x+b*y m = 2*c*max(x,y) if x<y: p = b else: p = a l = 2*c*min(x,y) + p*abs(x-y) ans = min(n,min(m,l)) print(ans)
p03371
s154731902
Accepted
a,b,c,x,y=map(int,input().split()) ans=0 ans1=0 e=max(x,y) ans1=e*(2*c) if 2*c<a+b: d=min(x,y) ans+=c*(2*d) x-=d y-=d else: ans=a*x+b*y x-=x y-=y ans+=x*a ans+=y*b print(min(ans,ans1))
p03371
s430228154
Accepted
A,B,C,X,Y=map(int,input().split()) anlist=[] for i in range(10**5+1): ans=2*C*i+A*max(0,X-i)+B*max(0,Y-i) anlist.append(ans) print(min(anlist))
p03371
s303688202
Accepted
import math S = input().split(" ") A = int(S[0]) B = int(S[1]) C = int(S[2]) X = int(S[3]) Y = int(S[4]) def calculate(a,b,c,x,y): base = min([x,y]) values = [] for index in range(base+1): tmp = 2 * C * index + a * (x - index) + b * (y - index) values.append(tmp) s2 = max([x,y]) * 2 * c values.append(s2) print(min(values)) calculate(A,B,C,X,Y)
p03371
s620389933
Accepted
A,B,C,X,Y = map(int, open(0).read().split()) ans=float('inf') for i in range(max(X,Y) + 1): now=2*C*i+max(0,X-i)*A+max(0,Y-i)*B ans=min(ans,now) print(ans)
p03371
s771307517
Accepted
A,B,C,X,Y = map(int,input().split()) ans = A * X + B * Y if X>=Y: ans1 = C * Y *2 + A * (X-Y) ans2 = C * X * 2 else: ans1 = C * X * 2 + B * (Y-X) ans2 = C * Y *2 print(min(ans, ans1,ans2))
p03371
s601386171
Accepted
A, B, C, X, Y = map(int, input().split()) ans = 10**10 for i in range(10**5+1): ans = min(ans, A*max(X-i, 0) + B*max(Y-i, 0) + 2*C*i) print(ans)
p03371
s002015504
Accepted
A, B, C, X, Y = map(int, input().split()) ans = A*X+B*Y for i in range(1, max(X, Y)+1): if i <= min(X, Y): ans = min(ans, ans+2*C-(A+B)) else: if X > Y: ans = min(ans, ans-A+2*C) else: ans = min(ans, ans-B+2*C) print(ans)
p03371
s742418798
Accepted
a,b,c,x,y=map(int,input().split()) if a+b<=2*c: print(a*x+b*y) elif x>=y: print(min(y*2*c+(x-y)*a,x*2*c)) else: print(min(x*2*c+(y-x)*b,y*2*c))
p03371
s831606635
Accepted
a,b,c,x,y = map(int,input().split()) c *= 2 ans = 0 z = min(x,y) if x >= y: w = x-z v = a else: w = y-z v = b ans += min(a+b,c)*z ans += min(v,c)*w print(ans)
p03371
s747015880
Accepted
a, b, c, x, y = map(int,input().split()) value = a+b values = c*2 ans = 0 if value <= values: ans += a*x + b*y print(ans) exit() if x>=y: ans += c*y*2 if a <= c*2: ans += a*(x-y) else: ans += c*2*(x-y) else: ans += c*x*2 if b <= c*2: ans += b*(y-x) else: ans += c*2*(y-x) print(ans)
p03371
s175917770
Accepted
a,b,c,x,y=map(int,input().split()) moneys=[] for i in range(0,max(x,y)*2+1,2): apizza=x-int(i/2) bpizza=y-int(i/2) if apizza<0: apizza=0 if bpizza<0: bpizza=0 money=apizza*a+bpizza*b+i*c moneys.append(money) print(min(moneys))
p03371
s177851215
Accepted
A,B,C,x,y = map(int,input().split()) ans = 0 if A+B > 2*C: ans += min(x,y)*C*2 else: ans += x*A + y*B print(ans) exit() if x >= y: x -= y y = 0 if A <2*C: ans += x*A else: ans += x*2*C else: y -= x x = 0 if B < 2*C: ans += y*B else: ans += y*2*C print(ans)
p03371
s180707120
Accepted
A,B,c,X,Y = map(int,input().split()) ans = 0 if X >= Y: x=X ; y=Y ; a=A ; b=B else: x=Y ; y=X ; a=B ; b=A if 2*c < a+b: ans += 2*c*y if x!=y: if 2*c < a: ans += 2*c*(x-y) else: ans += a*(x-y) else: ans += a*x + b*y print(ans)
p03371
s836910159
Accepted
A, B, AB, X, Y = map(int,input().split()) ans = 0 if A + B < 2*AB: ans += min(X,Y) * (A+B) else: ans += min(X,Y) * 2 * AB X, Y = X-min(X,Y), Y-min(X,Y) if X > 0: ans += min(X*A, 2*X*AB) else: ans += min(Y*B, 2*Y*AB) print(ans)
p03371
s826364007
Accepted
def main(): import math a, b, c, x, y = map(int, input().split()) d = [a, b] i, j = min(x, y), max(x, y) n = math.ceil(i / 2) f = j == x if 2 * c > (a + b): ans = a * x + b * y else: ans = 2 * c * i + (j - i) * min(c * 2, d[not f]) print(ans) if __name__ == '__main__': main()
p03371
s484774845
Accepted
A, B, C, X, Y = map(int, input().split()) ans = A * X + B * Y for i in range(1, max(X, Y) + 1): ab_n = i * 2 mix = C * ab_n + A * max(0, X - i) + B * max(0, Y - i) ans = min(ans, mix) print(ans)
p03371
s760336736
Accepted
import sys input = sys.stdin.readline a,b,c,x,y=map(int,input().split()) c1=a*x+b*y if x>=y: c2=2*y*c+(x-y)*a else: c2=2*x*c+(y-x)*b c3=2*max(x,y)*c print(min(c1,c2,c3))
p03371
s450748790
Accepted
A, B, C, X, Y = map(int, input().split()) ans = 10**10 for ab in range(max(X, Y) * 2 + 10): price = C * ab + max(0, X - ab // 2) * A + max(0, Y - ab // 2) * B ans = min(ans, price) print(ans)
p03371
s228347708
Accepted
a,b,c,x,y = map(int, input().split()) d = (a if x > y else b) print(min(a*x + b*y,min(x,y)*2*c + d*abs(x-y),max(x,y)*2*c))
p03371
s157366337
Accepted
A, B, C, X, Y = map(int, input().split()) ans = float('inf') for i in range(10 ** 5 + 1): ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + 2 * C * i) print(ans)
p03371
s607096316
Accepted
a, b, c, x, y = (map(int, input().split())) candi = [] for i in range(200001): candi.append((c*i)+max(0,(x-(i//2)))*a+max(0,(y-(i//2)))*b) print(min(candi))
p03371
s217029343
Accepted
a,b,c,x,y = map(int,input().split()) ans = 0 if (a+b) >= (2*c): ans += 2*c*min(x,y) if (x > y) and (a > 2*c): ans += 2*c*(x-y) elif (x > y) and (a <= 2*c): ans += a*(x-y) elif (x < y) and (b > 2*c): ans += 2*c*(y-x) elif (x < y) and (b <= 2*c): ans += b*(y-x) else: ans += a*x+b*y print(ans)
p03371
s570937056
Accepted
a, b, c, x, y = map(int, input().split()) ans = 0 if a + b >= c * 2: if x < y: temp = a a = b b = temp temp = x x = y y = temp if a > 2 * c: ans = x * 2 * c else: ans = y * 2 * c + a * (x - y) else: ans = a * x + b * y print(ans)
p03371
s337009328
Accepted
import sys input = sys.stdin.readline A,B,C,X,Y = [int(i) for i in input().split()] money = A * X + B * Y ans = money m = min(X,Y) M = max(X,Y) d = M - m if A + B > C * 2 : for i in range(m) : ans = ans -( A + B) + (2 * C) if m == X : if B * d > C * 2 * d : ans =ans - (B * d) + C * 2 * d else : if A * d > C * 2 * d : ans = ans -(A * d) + C * 2 * d print(ans)
p03371
s932949983
Accepted
import math A,B,C,X,Y = map(int,input().split()) ans = A * X + B * Y for c in range(2 * 10 ** 5 + 1): a = math.ceil(X - c * 0.5) b = math.ceil(Y - c * 0.5) if a < 0: a = 0 if b < 0: b = 0 mny = a * A + b * B + c * C if mny < ans: ans = mny print(ans)
p03371
s185942464
Accepted
#n=int(input()) A,B,C,X,Y=map(int,input().split()) #hl=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] mn=A*X+B*Y for i in range(max(X,Y)+1): mn=min(mn,2*i*C+A*max(0,X-i)+B*max(0,Y-i)) print(mn)
p03371
s202125485
Accepted
a, b, c, x, y = map(int, input().split()) ans = 5000 * 2 * (10**10) for i in range((10 ** 5) + 1): check = 2*c*i + max(x-i,0)*a + max(y-i,0)*b if(ans > check): ans = check print(ans)
p03371
s402331780
Accepted
#関数リスト 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() result = float('inf') result = min(result,int(A*X+B*Y)) temp = min(X,Y) result = min(result,int(C*temp*2+(X-temp)*A+(Y-temp)*B)) result = min(result, int(max(X, Y)*C*2)) print(result) if __name__ == "__main__": main()
p03371
s018642717
Accepted
import sys input = sys.stdin.readline # sys.setrecursionlimit(10 ** 6) # MOD = 10 ** 9 + 7 # INF = float("inf") def main(): a, b, c, x, y = map(int, input().split()) case1 = a * x + b * y if x - y > 0: case2 = c * 2 * y + a * (x - y) else: case2 = c * 2 * y if y - x > 0: case3 = c * 2 * x + b * (y - x) else: case3 = c * 2 * x print(min(case1, case2, case3)) if __name__ == '__main__': main()
p03371
s390550741
Accepted
A,B,C,X,Y=map(int,input().split()) print(min(A*X+B*Y,min(2*C*X+B*max(Y-X,0),A*max(X-Y,0)+2*C*Y)))
p03371
s869147620
Accepted
A,B,C,X,Y = map(int,input().split()) ans = float('inf') for i in range(0,2*max(X+1,Y+1)): cnt = 0 a = X - i//2 b = Y - i//2 if a<=0: a = 0 if b<= 0: b =0 cnt += (a)*A + C*i+(b)*B ans = min(ans,cnt) print(ans)
p03371
s436426449
Accepted
A, B, C, X, Y = map(int, input().split()) MAX = max(X, Y) MIN = 2*C*max(X, Y) i = MAX x=X y=Y while i > 0: tmpC = (MAX-i)*2*C total = (A*x)+(B*y)+tmpC if(MIN > total): MIN = total i-=1 if(x!=0): x-=1 if(y!=0): y-=1 print(MIN)
p03371
s131348875
Accepted
A,B,C,X,Y=map(int,input().split(' ')) price=[] for i in range(100001): price.append(2*C*i+A*max([X-i,0])+B*max([Y-i,0])) print(min(price))
p03371
s929179400
Accepted
def main(): a, b, c, x, y = map(int, input().split()) ans1 = x*a + y*b min_num = min(x, y) max_num = max(x, y) x, y = x-min_num, y-min_num ans2 = min_num*c*2 + max(x, 0)*a + max(y, 0)*b ans3 = max_num*c*2 ans = min(ans1, ans2, ans3) print(ans) if __name__ == "__main__": main()
p03371
s953197610
Accepted
A,B,C,X,Y=map(int,input().split()) a=min(X,Y)*min(A+B,2*C) a+=max(0,X-Y)*min(A,2*C) a+=max(0,Y-X)*min(B,2*C) print(a)
p03371
s046197022
Accepted
A, B, C, X, Y = map(int, input().split()) cost1 = A+B; cost2 = C*2 if X == Y : print( X* min( cost1, cost2)) elif X > Y: a = Y * min( cost1, cost2) + ( X - Y) * A b = X * min( cost1, cost2) print( min( a, b)) else : a = X * min( cost1, cost2) + ( Y - X) * B b = Y * min( cost1, cost2) print( min(a,b))
p03371
s119261632
Accepted
A, B, C, X, Y = map(int, input().split()) ans = 2*(5000*10**5) for Z in range(10**5+1): total = A*max(X-Z, 0)+B*max(Y-Z, 0)+2*C*Z ans = min(total,ans) print(ans)
p03371
s851339737
Accepted
A, B, C, X, Y = input().split(' ') A = int(A) B = int(B) C = int(C) X = int(X) Y = int(Y) if A > 2*C: A = 2*C if B > 2*C: B = 2*C if A + B <= 2*C: print(A*X+B*Y) else: if X > Y: sum = (X-Y)*A + Y*2*C else: sum = (Y-X)*B + X*2*C print(sum)
p03371
s202926774
Accepted
a, b, c, x, y = map(int, input().split()) ans = 10 ** 18 for i in range(0, 2 * max(x, y) + 1, 2): tmp = i * c if x - i // 2 > 0: tmp += (x - i // 2) * a if y - i // 2 > 0: tmp += (y - i // 2) * b ans = min(ans, tmp) print(ans)
p03371
s903018297
Accepted
import math def main(): A,B,C,X,Y = [int(x) for x in input().split()] ans = 0 if A+B <= C*2: # print('b') ans = A*X + B*Y else: if X<=Y: # print('c') ans = C*X*2 + min(B,C*2)*(Y-X) elif X>Y: # print('d') ans = C*Y*2 + min(A,C*2)*(X-Y) print(ans) if __name__ == '__main__': main()
p03371
s081914161
Accepted
A, B, C, X, Y = list(map(int, input().split())) result = float('inf') for i in range(0, max(X, Y)+1): tmp = C*2*i + max(0, X-i) * A + max(0, Y-i) * B if tmp < result: result = tmp print(result)
p03371
s035389426
Accepted
A, B, C, X, Y = map(int, input().split()) cost = 0 ab = min(X, Y) cost += min(ab * 2 * C, (A + B) * ab) X -= ab Y -= ab cost += min(C * 2, A) * X cost += min(C * 2, B) * Y print(cost)