problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p03371
s836688829
Accepted
a,b,c,x,y = map(int, input().split()) if (a+b <= c*2): print(a*x+b*y) else: if (x>=y): print(min(y*c*2+(x-y)*a,x*c*2)) else: print(min(x*c*2+(y-x)*b,y*c*2))
p03371
s715669250
Accepted
A, B, C, X, Y = map(int, input().split()) cost = 10**9 for i in range(2*10**5+1): if i%2==0: a_num = X-int(0.5*i) b_num = Y-int(0.5*i) if a_num < 0 and b_num < 0: break cost = min(cost, A*max(a_num, 0)+B*max(b_num, 0)+C*i) print(cost)
p03371
s747045596
Accepted
A, B, C, X, Y = map(int, input().split()) pay = 0 same = min(X, Y) pay += same * min(A + B, C * 2) X -= same Y -= same pay += X * min(A, C * 2) pay += Y * min(B, C * 2) print(pay)
p03371
s523674111
Accepted
a, b, c, x, y = map(int, input().split()) ans1 = a * x + b * y #そのまま ans2 = 0 if x > y: #少ない方をABで補う ans2 = c * min(x, y) * 2 + a * (x - y) else: ans2 = c * min(x, y) * 2 + b * (y - x) ans3 = c * max(x, y) * 2 #すべてABで print(min(ans1, ans2, ans3))
p03371
s187929126
Accepted
def inpl(): return list(map(int, input().split())) A, B, C, X, Y = inpl() ans = min(A + B, 2 * C) * min(X, Y) if X > Y: ans += min(A, 2 * C) * (X - Y) elif Y > X: ans += min(B, 2 * C) * (Y - X) print(ans)
p03371
s017410373
Accepted
A,B,C,X,Y = map(int,input().split()) cost = A*X + B*Y a = X b = Y c = 0 N = max(X,Y) for i in range(N): c += 2 if a > 0: a -= 1 if b > 0: b -= 1 cost = min(cost,A*a + B*b + c*C) print(cost)
p03371
s282157687
Accepted
a,b,c,x,y=map(int,input().split()) if a>=2*c and b>=2*c: print(max(x,y)*2*c) elif a<2*c and b>=2*c: print(y*2*c + max(0,x-y)*a) elif a>=2*c and b<2*c: print(x*2*c + max(0,y-x)*b) elif a+b>2*c: if x>y: print(y*2*c+(x-y)*a) else: print(x*2*c+(y-x)*b) else: print(a*x+b*y)
p03371
s342627755
Accepted
a,b,c,x,y=map(int,input().split()) res1=a*x+b*y if x>y: res2=c*2*y+a*(x-y) else: res2=c*2*x+b*(y-x) res3=c*2*max(x,y) print(min(res1,res2,res3))
p03371
s174684047
Accepted
A, B, C, X, Y = map(int, input().split()) ans = 10 ** 18 for i in range(0, 2 * max(X, Y) + 1, 2): tmpx = X - (i // 2) if tmpx <= 0: tmpx = 0 tmpy = Y - (i // 2) if tmpy <= 0: tmpy = 0 ans = min(ans, (i * C) + (tmpx * A) + (tmpy * B)) print(ans)
p03371
s063431997
Accepted
price_A, price_B, price_AB, num_A, num_B = map(int,input().split()) AandB = price_A * num_A + price_B * num_B if num_A >= num_B: minAB = price_AB*num_B*2 + price_A*(num_A-num_B) else: minAB = price_AB*num_A*2 + price_B*(num_B-num_A) maxAB = price_AB * max(num_A, num_B) * 2 print(min(AandB, minAB, maxAB))
p03371
s486959337
Accepted
a,b,c,x,y = map(int,input().split()) ans = 0 if a+b <= 2*c: ans = a*x+b*y else: if x>y: ans += 2*c*y l = x-y r = a else: ans += 2*c*x l = y-x r = b if 2*c < r: ans += 2*c*l else: ans += l*r print(ans)
p03371
s232898462
Accepted
#!/usr/bin/env python3 def II(): return int(input()) def MII(): return map(int, input().split()) def LII(): return list(map(int, input().split())) def main(): A, B, C, X, Y = MII() ans = A * X + B * Y for i in range(0, max(X, Y)+1): ans = min(ans, max(A * (X - i), 0) + max(B * (Y - i), 0) + C * 2 * i) print(ans) if __name__ == '__main__': main()
p03371
s386334831
Accepted
a, b, c, x, y = map(int, input().split()) A = a * x + b * y if x <= y: B = c * x * 2 + b * (y-x) else: B = c * y * 2 + a * (x-y) C = c * max(x, y) * 2 print(min(A, B, C))
p03371
s055754437
Accepted
def calcPizza(k, mai): return k*mai a,b,c,x,y = [int(i) for i in input().split(' ')] mins = min(x,y) asum = calcPizza(a, x) bsum = calcPizza(b, y) absum = calcPizza(c,mins*2) if x > mins: atmp= calcPizza(a,x-mins) abtmp= calcPizza(c,(x-mins)*2) absum += min(atmp,abtmp) elif y > mins: btmp = calcPizza(b,y-mins) abtmp = calcPizza(c,(y-mins)*2) absum += min(btmp,abtmp) print(min(asum+bsum, absum))
p03371
s578377345
Accepted
a,b,c,x,y = map(int, input().split()) if a+b <= c*2: print(a*x+b*y) else: if x == y: print(c*x*2) elif x > y: if a <= c*2: print(c*y*2+a*(x-y)) else: print(c*x*2) elif x < y: if b <= c*2: print(c*x*2+b*(y-x)) else: print(c*y*2)
p03371
s818800337
Accepted
def resolve(): A, B, C, X, Y = [int(i) for i in input().split()] # Cを0~max(X,Y)の2倍まで購入 minA = float("inf") for i in range(0, max(X, Y) * 2 + 1, 2): sumA = C * i sumA += (A * (X - i // 2) if (X - i // 2) > 0 else 0) sumA += (B * (Y - i // 2) if (Y - i // 2) > 0 else 0) minA = min(minA, sumA) print(minA) resolve()
p03371
s514946379
Accepted
A,B,C,X,Y=map(int,input().split()) cost=A*X+B*Y Z=max(X,Y) for i in range(0,2*Z+1,2): x=max(0,X-(i//2)) y=max(0,Y-(i//2)) cost=min(cost,C*i+A*x+B*y) print(cost)
p03371
s933087681
Accepted
A,B,C,X,Y = map(int, input().split()) ans = float('inf') for i in range(0,200001,2): a = max(0,X-i//2) b = max(0,Y-i//2) s = a*A+b*B+i*C ans = min(ans, s) print(ans)
p03371
s384517252
Accepted
def main(): A, B, C, X, Y = list(map(int, input().split(' '))) p1 = A * X + B * Y p2 = 2 * C * X + B * max([0, Y - X]) p3 = 2 * C * Y + A * max([0, X - Y]) p4 = 2 * C * max([X, Y]) print(min([p1, p2, p3, p4])) if __name__ == '__main__': main()
p03371
s323073671
Accepted
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) a,b,c,x,y = iim() print(min(a*x+b*y,2*y*c+max(x-y,0)*a,2*x*c+max(y-x,0)*b))
p03371
s759363677
Accepted
def modelAnswer(A:int,B:int,C:int,X:int,Y:int) -> int: ans = 10**9 for i in range(10**5+1): total = i * 2 * C + max(0,X-i) * A + max(0,Y-i) * B ans = min(ans,total) return ans def main(): A,B,C,X,Y=map(int,input().split()) print(modelAnswer(A,B,C,X,Y)) if __name__ == '__main__': main()
p03371
s174722776
Accepted
a, b, c, x, y = map(int, input().split()) p2 = 0 for i in range(max(x, y)): ai = a * (x - i) if i < x else 0 bi = b * (y - i) if i < y else 0 abi = 2 * i * c p1 = ai + bi + abi ai1 = a * (x - i - 1) if i < x else 0 bi1 = b * (y - i - 1) if i < y else 0 abi1 = 2 * (i + 1) * c p2 = ai1 + bi1 + abi1 if p1 < p2: print(p1) exit() print(p2)
p03371
s951172618
Accepted
A, B, C, X, Y = map(int, input().split()) ans = float("inf") # 全部ミックスピザ ans = min(2 * C * max(X, Y), ans) # 普通に買う ans = min(A * X + B * Y, ans) # 多少はミックスも買う if X >= Y: tmp = 2 * C * Y tmp += min((X - Y) * A, 2 * (X - Y) * C) ans = min(tmp, ans) else: # X < Y tmp = 2 * C * X tmp += min((Y - X) * B, 2 * (Y - X) * C) ans = min(tmp, ans) print(ans)
p03371
s581873665
Accepted
#<100q.全探索(計算量注意)> a, b, c, x, y = map(int,input().split()) ans1 = a * x + b * y if x <= y: ans2 = c * 2 * x + b * (y - x) ans5 = c * 2 * y else: ans2 = c * 2 * y + a * (x - y) ans5 = c * 2 * x ans3 = a * x + c * 2 * y ans4 = b * y + c * 2 * x ##print(ans1) ##print(ans2) ##print(ans3) ##print(ans4) ##print(ans5) print(min(ans1,ans2, ans3, ans4, ans5))
p03371
s702382898
Accepted
import sys stdin = sys.stdin mod = 10**9 + 7 ns = lambda: stdin.readline().rstrip() ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) A, B, C, X, Y = na() ans = 10**10 for ab in range((10**5+1)*2): cost = ab * C cost += max(0, X - ab//2) * A cost += max(0, Y - ab//2) * B ans = min(ans, cost) print(ans)
p03371
s456686847
Accepted
def main(): a, b, c, x, y = (int(i) for i in input().split()) v1 = 2*c*max(x, y) v2 = 2*c*min(x, y) + (y-x if x < y else x-y)*(b if x < y else a) v3 = a*x + b*y print(min(v1, v2, v3)) if __name__ == '__main__': main()
p03371
s439804065
Accepted
a,b,c,x,y = list(map(int,input().split())) if 2*c > a+b: ans = a*x + b*y else: ans = min(x,y)*2*c+(x-min(x,y))*(min(2*c,a))+(y-min(x,y))*(min(2*c,b)) print(ans)
p03371
s927315939
Accepted
A, B, C, X, Y = map(int, input().split()) ans = 10**18 for z in range(0, max(X, Y) * 2 + 1, 2): x, y = max(0, X - z // 2), max(0, Y - z // 2) tmp = A * x + B * y + C * z ans = min(ans, tmp) print(ans)
p03371
s227636580
Accepted
a,b,c,x,y=map(int, input().split( )) #超過してよい #x,y<=10000 ans=10**15 for i in range(0,max(x,y)+7): tmp = 2*i*c tmp+=max(0,(x-i)*a) tmp+=max(0,(y-i)*b) ans=min(ans, tmp) print(ans)
p03371
s622438354
Accepted
a, b, c, x, y = map(int, input().split()) if x < y: print(min(2*c*y, 2*c*x+b*(y-x), a*x+b*y)) else: print(min(2*c*x, 2*c*y+a*(x-y), a*x+b*y))
p03371
s677161923
Accepted
A, B, C, X, Y = map(int, input().split()) tmp = A*X + B*Y if X >= Y: tmp = min(tmp,2*Y*C+(X-Y)*A) else: tmp = min(tmp,2*X*C+(Y-X)*B) tmp = min(tmp,max(X,Y)*2*C) print(tmp)
p03371
s170570887
Accepted
a,b,c,x,y = map(int,input().split()) ans = 0 if c*2 <= a+b: m = min(x,y) ans += m*c*2 x -= m y -= m if 0 < x and c*x*2 < a*x: ans += (c*x*2) elif 0 < y and c*y*2 < b*y: ans += (c*y*2) else: ans += (a*x)+(b*y) else: ans = (a*x)+(b*y) print(ans)
p03371
s806477481
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
s440424433
Accepted
a, b, c, x, y = map(int, input().split()) ans = 0 if a + b >= c * 2: ans += min(x, y) * c * 2 x, y = x - min(x, y), y - min(x, y) if [a, b][y > x] >= c * 2: ans += max(x, y) * c * 2 else: ans += [a, b][y > x] * max(x, y) else: ans += a * x + b * y print(ans)
p03371
s590497035
Accepted
def resolve(): import math A, B, C, X, Y = map(int, input().split()) ans = [] for i in range(max(X, Y)*2+1): ans.append(C*i + A*(max(X-i/2, 0)) + B*(max(Y-i/2, 0))) print(math.floor(min(ans))) resolve()
p03371
s761108879
Accepted
a, b, c, x, y = map(int, input().split()) cost = a*x+b*y for i in range(max(x,y)): if min(x, y)-i-1 >=0: if cost > a*(x-i-1)+b*(y-i-1)+c*(i+1)*2: cost = a*(x-i-1)+b*(y-i-1)+c*(i+1)*2 elif x-i-1 < 0: if cost > b*(y-i-1)+c*(i+1)*2: cost = b*(y-i-1)+c*(i+1)*2 else: if cost > a*(x-i-1)+c*(i+1)*2: cost = a*(x-i-1)+c*(i+1)*2 print(cost)
p03371
s538328086
Accepted
a,b,c,x,y = map(int, input().split()) A = a * x + b * y if min(x,y) == x: B = c * x * 2 + (y-x) * b C = c * y * 2 else: B = c * y * 2 + (x-y) * a C = c * x * 2 print(min(A,B,C))
p03371
s624293994
Accepted
import sys IS = lambda: sys.stdin.readline().rstrip() II = lambda: int(IS()) MII = lambda: list(map(int, IS().split())) MIIZ = lambda: list(map(lambda x: x-1, MII())) def main(): a, b, c, x, y = MII() fee = min(a+b,c*2) * min(x,y) if x > y: fee += min(a,c*2)*(x-y) else: fee += min(b,c*2)*(y-x) print(fee) if __name__ == '__main__': main()
p03371
s787828853
Accepted
a,b,c,x,y=map(int,input().split()) ans=x*a+y*b if x>=y: ans=min(ans,c*min(x,y)*2+a*(x-y)) else: ans=min(c*min(x,y)*2+b*(y-x),ans) ans=min(c*max(x,y)*2,ans) print(ans)
p03371
s387275945
Accepted
a,b,c,x,y = map(int,input().split()) ans = float('inf') for i in range(0,2*max(x,y)+1,2): ab = i x_tmp = x - i//2 y_tmp = y - i//2 tmp = max(0,a*x_tmp) + max(0,b*y_tmp) + c*i if tmp < ans: ans = tmp print (ans)
p03371
s627237948
Accepted
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
s844773950
Accepted
a,b,c,x,y=map(int,input().split()) p = a*x + b*y q = 2*c*max(x,y) r = 2*c*x + b*(y-x) s = 2*c*y + a*(x-y) if x >=y: print(min(p,q,s)) else: print(min(p,q,r))
p03371
s713825460
Accepted
a,b,c,x,y=map(int,input().split()) ans1=a*x+b*y ans2=2*c*max(x,y) ans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y)) print(min(ans1,ans2,ans3))
p03371
s801924824
Accepted
A,B,C,X,Y=map(int,input().split()) price=0 if A+B>C+C: minXY=min(X,Y) price+=minXY*C*2 X-=minXY Y-=minXY if A>C+C: price+=X*2*C X=0 else: price+=A*X X=0 if B>C+C: price+=Y*2*C Y=0 else: price+=B*Y Y=0 print(price)
p03371
s547996364
Accepted
a,b,c,x,y = map(int,input().split()) if a + b <= c * 2: print(a*x+b*y) else: if x > y: print(min(x*2*c,y*2*c+(x-y)*a)) else: print(min(y*2*c,x*2*c+(y-x)*b))
p03371
s913380715
Accepted
a,b,c,x,y=map(int,input().split()) ans=10**9 for i in range(2*max(x,y)+1): s=max(x-i//2,0) t=max(y-i//2,0) t_ans=s*a+t*b+i*c ans=min(ans,t_ans) print(ans)
p03371
s199019048
Accepted
a,b,c,x,y = map(int,input().split()) cur = a*x+b*y z = 0 while True: x,y,z = x-1,y-1,z+2 if a*max(0,x)+b*max(0,y)+c*z <= cur: cur = a*max(0,x)+b*max(0,y)+c*z else: print(cur) exit()
p03371
s279434527
Accepted
a,b,c,x,y=map(int,input().split()) p=10**9 for i in range(max(x,y)+1): p=min(p,a*max(0,x-i)+b*max(0,y-i)+c*2*i) print(p)
p03371
s612395438
Accepted
a, b, c, x, y, = map(int, input().split()) price = 10 ** 16 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
s776169588
Accepted
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): a, b, c, x, y = map(int, input().split()) ans = 10 ** 10 yen = 0 if a + b > c * 2: yen += (c * 2 * min(x, y)) x, y = x - min(x, y), y - min(x, y) if x > 0: yen += min(x * a, x * 2 * c) else: yen += min(y * b, y * 2 * c) else: yen += a * x + b * y print(yen) resolve()
p03371
s831627742
Accepted
a, b, c, x, y = map(int, input().split()) price = float("inf") max_iter = max(x, y)*2 for i in range(max_iter): a_num = max(x-i, 0) b_num = max(y-i, 0) price = min(price, a_num*a + b_num*b + 2*i*c) print(price)
p03371
s969556923
Accepted
a,b,ab,x,y=map(int,input().split()) total=0 if a+b>2*ab: total+=min(x,y)*2*ab if x>y: x-=y if a>=2*ab: total+=2*ab*x else: total+=a*x elif x<y: y-=x if b>=2*ab: total+=2*ab*y else: total+=b*y else: total+=a*x+b*y print(total)
p03371
s653540677
Accepted
A, B, C, X, Y = map(int, input().split()) if A + B >= C * 2: price = min(X, Y) * C * 2 tmp = min(X,Y) X = X - tmp Y = Y - tmp if A * X < C * X * 2: price += A * X X -= X if B * Y < C * Y * 2: price += B * Y Y -= Y price += C * 2 * max(X, Y) print(price) else: print(A * X + B * Y)
p03371
s107774086
Accepted
A,B,C,X,Y = map(int,input().split()) ans = 10**9+7 for i in range(max(X,Y)+1): AB = i*2 money = max(0,A*(X-i))+max(0,B*(Y-i))+C*AB ans = min(ans,money) print(ans)
p03371
s227744398
Accepted
import math import itertools import numpy as np def solve(): a, b, c, x, y = map(int, input().split()) case1 = a * x + b * y case2 = x * 2 * c + max(0, (y - x) * b) case3 = max(0, (x - y) * a) + y * 2 * c case4 = max(x, y) * 2 * c print(min(case1, case2,case3,case4)) return 0 if __name__ == "__main__": solve()
p03371
s262788269
Accepted
def solve(): A, B, C, X, Y = map(int, input().split()) ans = 5000 * 2 * 10 ** 5 for i in range(max(X, Y) + 1): ans = min(ans, 2 * i * C + A * max(0, X - i) + B * max(0, Y - i)) print(ans) if __name__ == '__main__': solve()
p03371
s172907327
Accepted
A,B,C,X,Y = map(int,input().split()) if 2*C >= A+B: print(X*A+Y*B) else: if X >= Y: if A > 2*C: print(2*X*C) else: print(2*Y*C + (X-Y)*A) else: if B > 2*C: print(2*Y*C) else: print(2*X*C+(Y-X)*B)
p03371
s764467547
Accepted
A, B, C, X, Y = list(map(int, input().split())) C *= 2 min_cost = float('inf') for ab in range(max(X + 1, Y + 1)): cost = ab * C cost += A * max(0, X - ab) cost += B * max(0, Y - ab) if min_cost > cost: min_cost = cost print(min_cost)
p03371
s729937770
Accepted
# -*- coding: utf-8 -*- def main(): A, B, C, X, Y = map(int, input().split()) if A + B <= 2 * C: ans = (A * X + B * Y) else: if X <= Y: ans = min(2 * C * X + B * (Y - X), 2 * C * Y) else: ans = min(2 * C * Y + A * (X - Y), 2 * C * X) print(ans) if __name__ == "__main__": main()
p03371
s014279235
Accepted
A, B, C, X, Y = map(int, input().split()) price = A*X + B*Y tmp = 0 for i in range(1, int(1 + 10e5)): tmp = 2*C*i + max(0, X-i)*A + max(0, Y-i)*B price = min(price, tmp) print(price)
p03371
s893730989
Accepted
a,b,c,x,y = map(int,input().split()) if x < y: a, b, x, y = b, a, y, x print(min(a*x+b*y,2*c*y + a*(x-y),2*c*x))
p03371
s815063707
Accepted
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): A, B, C, X, Y = map(int, input().split()) print( min(X * A + Y * B, 2 * X * C + B * max(0, Y - X), 2 * Y * C + A * max(0, X - Y))) if __name__ == "__main__": main()
p03371
s387694998
Accepted
A,B,C,X,Y=map(int,input().split()) print(min(A*X+B*Y,C*2*Y+A*max(0,X-Y),C*2*X+B*max(0,Y-X)))
p03371
s253136676
Accepted
import sys a, b, c, x, y = map(int, sys.stdin.readline().split()) if x > y: a, b = b, a x, y = y, x def main(): res = min(c * 2, a + b) * x + min(c * 2, b) * (y - x) print(res) if __name__ == '__main__': main()
p03371
s796243895
Accepted
A,B,C,X,Y = list(map(int,input().split())) tan = A*X + B*Y hukuA = max(X,Y)*2*C hukuB = min(X,Y)*2*C + (max(X,Y)-min(X,Y)) * (A if X>=Y else B) print(min(tan,hukuA,hukuB))
p03371
s960786730
Accepted
a,b,c,x,y=map(int,input().split()) m=10**10 for i in range(10**6): m=min(m,2*c*i+a*max(0,x-i)+b*max(0,y-i)) print(m)
p03371
s926976362
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
s598798830
Accepted
a,b,c,x,y=map(int,input().split()) loop=max(x*2,y*2)+1 ans=10**9 for i in range(loop): ab=i//2 if x-ab>=0 and y-ab>=0: ans=min(ans,a*(x-ab)+b*(y-ab)+c*i) if x>=ab and y<ab: ans=min(ans,a*(x-ab)+c*i) if x<ab and y>=ab: ans=min(ans,b*(y-ab)+c*i) if x<ab and y<ab: ans=min(ans,c*i) print(ans)
p03371
s449673536
Accepted
import math A,B,C,X,Y=map(int,input().split()) limit=max(2*X,2*Y) ans=float('inf') #L=[] for i in range(limit+1): temp=C*i+A*math.ceil(max(0,X-i/2))+B*math.ceil(max(0,Y-i/2)) #L.append(temp) ans=min(ans,temp) print(ans) #print(L)
p03371
s478189157
Accepted
a,b,c,x,y=map(int,input().split()) if a+b <= c*2: print(a*x +b*y) else: if x>y: i=a elif x<y: i=b else: i=0 p=min(x,y)*c*2 + abs(x-y)*i q=max(x,y)*c*2 if p >= q: print(q) else: print(p)
p03371
s577585933
Accepted
#!/usr/bin/python3 #coding: utf-8 A, B, C, X, Y = (int(x) for x in input().split()) ret = 0 if A + B > C * 2: m = min(X, Y) X -= m Y -= m ret += m * C * 2 if X > 0: if A > C * 2: ret += X * C * 2 else: ret += X * A if Y > 0: if B > C * 2: ret += Y * C * 2 else: ret += Y * B print(ret)
p03371
s733253211
Accepted
a,b,c,x,y=[int(i) for i in input().split()] ans=1000000000 for k in range(10**5+1): money=2*c*k + max(x-k,0)*a + max(y-k,0)*b if(ans>money): ans=money print(ans)
p03371
s337848559
Accepted
a, b, c, x, y = map(int, input().split()) # i組みのabを買うことについて全探索 ans = float("inf") for i in range(max(x, y)+1): price = i * 2 * c + max(x-i, 0) * a + max(y-i, 0) * b ans = min(ans, price) print(ans)
p03371
s148100657
Accepted
a,b,c,x,y = map(int, input().split()) ab = min(a+b,2*c) a = min(a,2*c) b = min(b,2*c) print((x-y)*a+y*ab if x>y else (y-x)*b+x*ab)
p03371
s985800102
Accepted
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*y+a*(x-y),2*c*x))
p03371
s516825040
Accepted
A, B, C, X, Y = map(int, input().split()) min_price = A * X + B * Y if A + B > 2 * C: while X > 0 and Y > 0: X = X - 1 Y = Y - 1 min_price -= A + B - 2 * C if X > 0 and A > 2 * C: while X > 0: X = X - 1 min_price -= A - 2 * C if Y > 0 and B > 2 * C: while Y > 0: Y = Y - 1 min_price -= B - 2 * C print(min_price)
p03371
s572185010
Accepted
a,b,c,x,y=map(int,input().split()) ret=float('inf') for i in range(max(x,y)+1): ret=min(ret,i*c*2+max((x-i),0)*a+max((y-i),0)*b) print(ret)
p03371
s667622066
Accepted
a,b,c,x,y=map(int,input().split()) if (a+b)>2*c: if x>y: if a>2*c: print(y*2*c+(x-y)*c*2) else: print(y*2*c+(x-y)*a) else: if b>2*c: print(x*2*c+(y-x)*c*2) else: print(x*2*c+(y-x)*b) else: print(x*a+y*b)
p03371
s389104190
Accepted
a,b,c,x,y=map(int,input().split()) ans=a*x+b*y if x>y: p=2*y*c+(x-y)*min(a,2*c) ans=min(ans,p) if x<=y: p=2*x*c+(y-x)*min(b,2*c) ans=min(ans,p) print(ans)
p03371
s438221008
Accepted
a, b, c, x, y = map(int, input().split()) ans = a*x + b*y ans = min(ans, 2*c*max(x, y)) if x < y: ans = min(ans, c*2*x + b*(y-x)) else: ans = min(ans, c*2*y + a*(x-y)) print(ans)
p03371
s175216437
Accepted
# ABC95_C a,b,c,x,y = map(int,input().split()) ans = 0 if c * 2 > a + b: ans += a * x + b * y else: if x > y: ans += c * 2 * y if a > c * 2: ans += (x - y) * c * 2 else: ans += (x - y) * a else: ans += c * 2 * x if b > c * 2: ans += (y - x) * c * 2 else: ans += (y - x) * b print(ans)
p03371
s975869104
Accepted
a, b, c, x, y = map(int, input().split()) pmin = 10**10 for i in range(max(x, y)+1): # 2i枚のABピザを買う bx = max(0, x - i) by = max(0, y - i) pay = a*bx + b*by + 2*c*i pmin = min(pmin, pay) print(pmin)
p03371
s214979593
Accepted
a,b,c,x,y = map(int,input().split()) p = max(x,y) q = min(x,y) ans = 0 if a+b>=2*c: if p == x: ans += 2*c*q + min(a,2*c)*(p-q) else: ans += 2*c*q + min(b,2*c)*(p-q) else: if p == x: ans += (a+b)*q + min(a,2*c)*(p-q) else: ans += (a+b)*q + min(b,2*c)*(p-q) print(ans) # print(a,b,c,x,y)
p03371
s997499670
Accepted
a, b, c, x, y = map(int, input().split()) if 2 * c == min(2 * c, a, b): print(c * 2 * max(x, y)) elif 2 * c <= max(a, b) and a == max(a, b): print(c * 2 * x + b * max(y - x, 0)) elif 2 * c <= max(a, b) and b == max(a, b): print(c * 2 * y + a * max(x - y, 0)) elif 2 * c <= a + b and x <= y: print(c * 2 * x + b * (y - x)) elif 2 * c <= a + b and x > y: print(c * 2 * y + a * (x - y)) else: print(a * x + b * y)
p03371
s563336664
Accepted
from collections import Counter a, b, ab, x, y = map(int, input().split()) if a+b >= ab*2: if x < y: less, more = x, y cost_l, cost_m = a, b else: less, more = y, x cost_l, cost_m = b, a cost = less*ab*2 more -= less less = 0 if cost_m < ab * 2: cost += more*cost_m else: cost += more*ab*2 print(cost) else: print(a*x+b*y)
p03371
s612298380
Accepted
A, B, C, X, Y = map(int, input().split()) min_num = min(X, Y) max_num = min(X, Y) min_price = min(A + B, C * 2) max_price = min(A + B, C * 2) answer = min_num * min_price # print(answer) if X >= Y: answer += (X - min_num) * min(A, C * 2) else: answer += (Y - min_num) * min(B, C * 2) print(answer)
p03371
s956054034
Accepted
A,B,C,X,Y = map(int,input().split()) if X>Y: A,B,X,Y = B,A,Y,X if 2*C < B: print(C*2*Y) elif 2*C < A + B: print(C*2*X+B*(Y-X)) else: print(A*X+B*Y)
p03371
s037491416
Accepted
a, b, c, x, y = [int(x) for x in input().split()] if x <= y: ans = min(a + b, 2 * c) * x ans += min(b, 2 * c) * (y - x) else: ans = min(a + b, 2 * c) * y ans += min(a, 2 * c) * (x - y) print(ans)
p03371
s364691038
Accepted
a, b, c, x, y = map(int, input().split()) if x > y: tmp = c*y*2+a*(x-y) else: tmp = c*x*2+b*(y-x) ans = min(a*x+b*y, c*max(x, y)*2, tmp) print(ans)
p03371
s988413420
Accepted
A,B,C,X,Y=map(int,input().split()) ans=5000*(10**5)*2+1 for i in range(max(X,Y)+1): total=0 total=2*C*i+A*max(X-i,0)+B*max(Y-i,0) if ans>=total: ans=total print(ans)
p03371
s630469182
Accepted
a, b, c, x, y = map(int, input().split()) ans = float("inf") for i in range(0, max(2*x, 2*y)+1, 2): na = 0 if x-i//2 < 0 else x-i//2 nb = 0 if y-i//2 < 0 else y-i//2 ans = min(ans, c*i + a*na + b*nb) print(ans)
p03371
s168887488
Accepted
a, b, c, x, y = map(int,input().split()) if a+b <= c * 2: print(x*a + y*b) exit() ans = 0 ans += min(x,y) * c * 2 if x >= y: ans += min((x-y)*a, (x-y)*2*c) else: ans += min((y-x)*b, (y-x)*2*c) print(ans)
p03371
s782715565
Accepted
a, b, c, x, y = map(int, input().split()) # ABを買わない、AorBを買わない、AandBを買わない if x >= y: print(min(x*a + y*b, 2*y*c + (x - y)*a, 2*x*c)) else: print(min(x*a + y*b, 2*x*c + (y - x)*b, 2*y*c))
p03371
s918169628
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
s844517507
Accepted
a,b,c,x,y=map(int,input().split()) minpr=10e+10 memo=None if x>=y: for i in range(x+1): price= i*a+ 2*(x-i)*c+ max(0,y-(x-i))*b minpr=min(price,minpr) print(minpr) else: for i in range(y+1): price= i*b+ 2*(y-i)*c+ max(0,x-(y-i))*a minpr=min(price,minpr) print(minpr)
p03371
s470107269
Accepted
A,B,C,X,Y = map(int,input().split()) AB_set = C * 2 ans = min(A*X + B*Y, AB_set*max(X,Y), AB_set*min(X,Y) + A*abs(X-min(X,Y)) + B*abs(Y-min(X,Y))) print(ans)
p03371
s062027630
Accepted
A,B,C,X,Y = map(int,input().split()) res = A*X +B*Y for i in range(0,max(X,Y)+1): cand = 2*i*C + max(0,X-i)*A + max(0,Y-i)*B res = min(res,cand) print(res)
p03371
s176033279
Accepted
a, b, c, x, y = map(int,input().split()) min_xy = min(x, y) max_xy = max(x, y) min_xy_cost = min(a + b, c * 2) * min_xy if x >= y: rest = x - y rest_cost = rest * min(a, c * 2) else: rest = y - x rest_cost = rest * min(b, c * 2) total = min_xy_cost + rest_cost print(total)
p03371
s285592193
Accepted
A, B, C, X, Y = list(map(int, input().split())) max_AB = max(X, Y) ans = float('inf') for i in range(0, max_AB + 1): X_num = max(X - i, 0) Y_num = max(Y - i, 0) ans = min(X_num * A + Y_num * B + 2 * C * i, ans) print(ans)
p03371
s663305360
Accepted
# -*- coding: utf-8 -*- a,b,c,x,y = [int(i) for i in input().split()] if x <= y: ans1 = min(c * x * 2 + b * (y - x), c * y * 2) #print('a') else: #x > y ans1 = min(c * y * 2 + a * (x - y), c * x * 2) #print('b') ans2 = a * x + b * y print(min(ans1, ans2))