problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p03371 | s634006123 | Accepted | A, B, C, X, Y = list(map(int, input().split()))
if X == Y:
print(min(A + B, 2 * C) * X)
elif X < Y:
print(min(A + B, 2 * C) * X + min(B, 2 * C) * (Y - X))
else:
print(min(A + B, 2 * C) * Y + min(A, 2 * C) * (X - Y))
|
p03371 | s044559558 | Accepted | A,B,C,X,Y=map(int,input().split())
ans=10**10
Z=max(X,Y)
for i in range(0, Z+1):
tmp=C*i*2
if X-i>=0:
tmp+=A*(X-i)
if Y-i>=0:
tmp+=B*(Y-i)
ans=min(ans,tmp)
print(ans)
|
p03371 | s351306768 | 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 | s492893273 | Accepted | a,b,c,x,y=map(int,input().split())
c=c*2
print(min(c*max(x,y),y*c+max(x-y,0)*a,x*c+max(y-x,0)*b,a*x+b*y)) |
p03371 | s607675311 | Accepted | def main():
a, b, c, x, y = map(int, input().split())
p = {x: a, y: b}
print(min(a * x + b * y, c * max(x, y) * 2, c * min(x, y) * 2 + (max(x, y) - min(x, y)) * p[max(x, y)]))
if __name__ == '__main__':
main()
|
p03371 | s957358104 | Accepted | # coding:UTF-8
import sys
from math import factorial
MOD = 10 ** 9 + 7
INF = float('inf')
A, B, C, X, Y = list(map(int, input().split())) # スペース区切り連続数字
mcost = INF
cnum = max(X, Y)
for i in range(cnum+1):
anum = max(0, (X - i))
bnum = max(0, (Y - i))
cost = A * anum + B * bnum + C * i * 2
mcost = min(mcost, cost)
print("{}".format(mcost))
|
p03371 | s765008807 | Accepted | #C
a, b, c, x, y = map(int,input().split())
ans = 10**10
for i in range(10**5+1):
ans = min(ans,2*c*i + a*max(0,x-i) + b*max(0,y-i))
print(ans) |
p03371 | s036122895 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 0
if A + B < 2 * C:
print(A * X + B * Y)
else:
while X > 0 and Y > 0:
ans += 2 * C
X -= 1
Y -= 1
if A > 2 * C:
A = 2 * C
if B > 2 * C:
B = 2 * C
print(ans + A * X + B * Y) |
p03371 | s130211993 | Accepted | a,b,c,x,y=map(int, input().split())
max_=max(x,y)
cost=100000000000
for i in range(max_+1):
cost_=i*2*c+a*max(0,x-i)+b*max(0,y-i)
cost=min(cost_,cost)
print(cost) |
p03371 | s498381121 | Accepted | import sys, math
def input():
return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
A, B, C, X, Y = map(int, input().split())
val1 = A*X + B*Y
minXY = min(X, Y)
val2 = C*2*minXY + A*(X-minXY) + B*(Y-minXY)
maxXY = max(X, Y)
val3 = C*2*maxXY
print(min(val1, val2, val3))
|
p03371 | s918194243 | Accepted | a,b,c,x,y = map(int,input().split())
plan1 = a*x+b*y
plan2 = c*max(x,y)*2
plan3 = c*x*2+b*(y-x) if x<y else c*y*2+a*(x-y)
print(min(plan1,plan2,plan3)) |
p03371 | s175181132 | Accepted | A,B,C,X,Y = map(int,input().split())
C*=2
minxy = min(X,Y)
maxxy = max(X,Y)
ans1 = C * minxy + A * (X-minxy) + B * (Y-minxy)
ans2 = A*X + B*Y
ans3 = C * maxxy
print (min(ans1,ans2,ans3)) |
p03371 | s509787290 | Accepted | piza = list(map(int,input().split()))
x = piza[0] * piza[3] + piza[1] * piza[4]
y = piza[2] * 2 * max(piza[3],piza[4])
if piza[3] >= piza[4]:
z = piza[2] * (2 * piza[4]) + piza[0]*(piza[3]-piza[4])
else:
z = piza[2] * (2 * piza[3]) + piza[1]*(piza[4]-piza[3])
print(min(x,y,z)) |
p03371 | s948041496 | Accepted | # AtCoder Beginner Contest 095 C - Half and Half
import sys
A, B, C, X, Y = map(int, sys.stdin.readline().strip().split())
"""
ans = A * X + B * Y
for z in range(2, 2 * 10 ** 5 + 1, 2):
x = max(X - int(z / 2), 0)
y = max(Y - int(z / 2), 0)
price = A * x + B * y + C * z
ans = min(price, ans)
print(ans)
"""
price1 = A * X + B * Y
price2 = C * 2 * X + B * max(Y - X, 0)
price3 = A * max(X - Y, 0) + C * 2 * Y
print(min(price1, price2, price3))
|
p03371 | s614340278 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(max(X,Y)+1):
cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B
ans = min(ans,cost)
print(ans) |
p03371 | s927272135 | Accepted | a,b,c,x,y=map(int,input().split())
res1=a*x+b*y
if x>y:
res2=2*y*c+(x-y)*a
else:
res2=2*x*c+(y-x)*b
res3=2*max(x,y)*c
print(min(res1,res2,res3)) |
p03371 | s101121188 | 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 | s958711706 | Accepted | A,B,C,X,Y = map(int,input().split())
CtoAB1 =0
CtoAB2 =0
AandB =0
if X >= Y:
CtoAB1=2*C*Y+A*(X-Y)
CtoAB2=2*C*X
else:
CtoAB1=2*C*X+B*(Y-X)
CtoAB2=2*C*Y
AandB=A*X+B*Y
print(min(CtoAB1,CtoAB2,AandB)) |
p03371 | s417339375 | Accepted | A, B, C, X, Y = map(int, input().split())
if A+B <= 2*C:
ans = X*A + Y*B
else:
z = min(X, Y)
if z == X:
c = B
else:
c = A
ans = C*2*z
Z = max(X, Y) - z
if c <= 2*C:
ans += c*Z
else:
ans += 2*C*Z
print(ans) |
p03371 | s221419045 | Accepted | a,b,c,x,y=map(int,input().split())
print(min(a*max(0,(x-i))+b*max(0,(y-i))+2*c*i for i in range(max(x,y)+1))) |
p03371 | s511222468 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 10**18
for i in range(0, 2*max(X, Y)+2, 2):
ans = min(ans, i * C + max(X-(i//2), 0) * A + max(Y-(i//2), 0) * B)
print(ans) |
p03371 | s319095107 | Accepted | #!/usr/bin/env python
import math
def main():
A, B, C, X, Y = map(int, input().split())
ans = float("inf")
for k in range(2 * max(X, Y) + 1):
i = max(0, math.ceil(X - 0.5 * k))
j = max(0, math.ceil(Y - 0.5 * k))
total = A * i + B * j + C * k
if ans > total:
ans = total
print(ans)
if __name__ == '__main__':
main() |
p03371 | s392779179 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 10 ** 18
for i in range(10 ** 5 * 2):
ans = min(ans, i * 2 * c + max(0, x - i) * a + max(0, y - i) * b)
print(ans)
|
p03371 | s938577177 | Accepted | A,B,C,X,Y=map(int,input().split())
print(min(min(2*C*max(X,Y),A*X+B*Y),min(2*C*X+B*max(Y-X,0),A*max(X-Y,0)+2*C*Y))) |
p03371 | s644902912 | Accepted | A, B, C, X, Y = map(int, input().split())
if (A + B > 2 * C):
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 | s554203475 | 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 (max((x-i),0)*a + max((y-i),0)*b + c*2*i) < ans:
ans = (max((x-i),0)*a + max((y-i),0)*b + c*2*i)
print(ans)
|
p03371 | s618225525 | Accepted | A,B,C,X,Y = list(map(int,input().split()))
if A+B <= 2*C:
print(A*X+B*Y)
exit()
if X == Y:
print(2*C*X)
elif X > Y:
tmp = 2*C*Y
X -= Y
m = min(2*C*X,A*X)
print(tmp+m)
else:
tmp = 2*C*X
Y -= X
m = min(2*C*Y,B*Y)
print(tmp+m) |
p03371 | s414730993 | 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(2*c*x+min(b,2*c)*abs(y-x))
else:
print(2*c*y+min(a,2*c)*abs(y-x)) |
p03371 | s495504860 | Accepted | a,b,c,x,y=map(int,input().split())
ans=min(a*x+b*y,2*c*x+b*max(0,y-x),2*c*y+a*max(0,x-y))
print(ans) |
p03371 | s629265711 | Accepted | A,B,C,X,Y = map(int,input().split())
x = 0
y = 0
pay = 0
if X == Y:
pay = min(A*X+B*Y,2*C*X)
elif X > Y:
pay = min(A*X+B*Y,2*C*Y+A*(X-Y),2*C*X)
else:
pay = min(A*X+B*Y,2*C*X+B*(Y-X),2*C*Y)
print(pay) |
p03371 | s067019592 | Accepted | A, B, C, X, Y = map(int, input().split())
ret = A * X + B * Y
x = 0
y = 0
c = 0
while (X + Y) * 2 > c :
c += 2
x += 1
y += 1
tmp = A * max(0, X - x) + B * max(0, Y - y) + c * C
ret = min(ret, tmp)
print(ret) |
p03371 | s439802693 | Accepted | a, b, c, x, y = map(int, input().split())
ab = c*2
if a+b > ab:
t = ab*min(x,y)
d = max(x,y)-min(x,y)
if x>y: dd = a*d
else: dd = b*d
print(t+ab*d if dd>ab*d else t+dd)
else:
print(a*x+b*y) |
p03371 | s638178669 | Accepted | a, b, c, x, y = map(int, input().split())
each = 0
if x==y:
each = 0
elif x>y:
each = min(a, 2*c)*(x-y)
else:
each = min(b, 2*c)*(y-x)
print(min(min(x, y)*2*c+each, min(a, 2*c)*x + min(b, 2*c)*y))
|
p03371 | s994786352 | Accepted | a, b, c, x, y = map(int, input().split())
pmin = 10**10
for i in range(0, 2*max(x, y)+1, 2): # i枚のABピザを買う
bx = max(0, x - i//2)
by = max(0, y - i//2)
pay = a*bx + b*by + c*i
pmin = min(pmin, pay)
print(pmin) |
p03371 | s400556517 | Accepted | A, B, C, X, Y = map(int, input().split())
if A + B < 2 * C:
print(A*X + B*Y)
else:
C_num = min(X, Y)
print(min(2*C*max(X, Y), C_num*2*C + A*(X-C_num) + B*(Y-C_num))) |
p03371 | s949933626 | Accepted | a,b,c,x,y=map(int,input().split())
z=min(x,y)
sm=min((a+b)*z,c*2*z)
if x>z: sm+=min(a,2*c)*(x-z)
else : sm+=min(b,2*c)*(y-z)
print(sm) |
p03371 | s269414062 | Accepted | def main():
import sys
def input(): return sys.stdin.readline().rstrip()
a, b, c, x, y = map(int, input().split())
lim = max(x, y)
ans = 10**12
for i in range(lim+1):
price = a*max(0, x-i) + b*max(0, y-i) + c*2*i
ans = min(ans, price)
print(ans)
if __name__ == '__main__':
main()
|
p03371 | s263365250 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = A * X + B * Y
for z in range(0, 2*max(X, Y)+1, 2):
a = C*z + A * max(0,X - z//2) + B * max(0, Y - z//2)
ans = min(ans, a)
print(ans) |
p03371 | s312690761 | Accepted | A, B, C, X, Y = list(map(int, input().split()))
a = A*X+B*Y
b = max(X,Y)*C*2
c = min(X,Y)*C*2
if max(X,Y) == X:
c += (X-Y)*A
else:
c += (Y-X)*B
print(min(min(a,b),c)) |
p03371 | s202865035 | Accepted | A, B, C, X, Y = map(int, input().split())
Sum = A * X + B * Y
if A+B > 2*C:
if X < Y:
if 2*C <= B:
Sum = C * 2 * Y
else:
Sum = C * 2 * X + B * (Y - X)
elif Y < X:
if 2*C <= A:
Sum = C * 2 * X
else:
Sum = C * 2 * Y + A * (X - Y)
else:
Sum = C * 2 * X
print(Sum) |
p03371 | s495781910 | Accepted | a,b,c,x,y = map(int, input().split())
if a + b <= 2*c:
print(a*x+b*y)
else:
ab_cnt = min(x,y)
remain_a = x-ab_cnt
remain_b = y-ab_cnt
if remain_a > 0 and a > 2*c:
print(ab_cnt*2*c + remain_a*2*c)
elif remain_b > 0 and b > 2*c:
print(ab_cnt*2*c + remain_b*2*c)
else:
print(ab_cnt*2*c + remain_a*a + remain_b*b) |
p03371 | s516203046 | Accepted | a, b, c, x, y = map(int, input().split())
# 3通り
# 1: ax+by
# 2: 2c*large
# 3: 2c*small + (a/b) * diff
tar1 = a * x + b * y
tar2 = 2 * c * max(x, y)
dif = abs(x - y)
if (x > y):
tar3 = 2 * c * y + a * (x - y)
else:
tar3 = 2 * c * x + b * (y - x)
ans = min(tar1, tar2, tar3)
# ---------
print(ans)
|
p03371 | s767631651 | Accepted | A,B,C,X,Y=map(int,input().split())
#print(A,B,C,X,Y)
M=max(X,Y)*2
ans=float('inf')
for i in range(M+1):
x=max(0,X-i//2)
y=max(0,Y-i//2)
#x=max(0,X-(-(-i//2)))
#y=max(0,Y-(-(-i//2)))
tmp=A*x+B*y+C*i
if ans>tmp:
ans=tmp
print(ans) |
p03371 | s524461965 | Accepted | a,b,c,x,y = map(int,input().split())
ans = float('inf')
for i in range(0,2*10**5+1):
cost = c * i
cost += a * max(0, x - i//2)
cost += b * max(0, y - i//2)
ans = min(ans,cost)
print(ans) |
p03371 | s031715915 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(2*10**5+1):
price = C * i + max(0, X - i // 2) * A + max(0, Y - i // 2) * B
ans = min(ans, price)
print(ans) |
p03371 | s809398448 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 0
if a+b <= c*2:
ans += min(x, y)*(a+b)
else:
ans += min(x, y)*c*2
if x > y:
if a <= c*2:
ans += (x-y)*a
else:
ans += (x-y)*c*2
else:
if b <= c*2:
ans += (y-x)*b
else:
ans += (y-x)*c*2
print(ans)
|
p03371 | s376162548 | Accepted | # 単体ピザで埋めてからハーフピザを買うか、
# ハーフピザで埋めてから単体ピザを足すのが良いはず。
A, B, C, X, Y = map(int, input().split())
a, b = X, Y
est = []
#ハーフ埋め
esth = C * min(X, Y) * 2
a -= min(X,Y)
b -= min(X,Y)
esth += A * a + B * b
est.append(esth)
#全ハーフ
a, b = X, Y
estah = C * max(X, Y) * 2
est.append(estah)
#全単品
a, b = X, Y
estfa = A * a + B * b
est.append(estfa)
print(min(est))
|
p03371 | s775869221 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = min(A * X + B * Y,
B * max(0, Y - X) + C * X * 2,
A * max(0, X - Y) + C * Y * 2)
print(ans)
|
p03371 | s252967736 | Accepted | a,b,c,x,y = map(int,input().split())
d = c * 2 #aピザ1枚とbピザ1枚
if a + b < d:
print(x * a + y * b)
exit()
elif x >= y:
tmp1 = y * d + (x - y) * a
tmp2 = x * d
print(min(tmp1, tmp2))
elif y > x:
tmp1 = x * d + (y - x) * b
tmp2 = y * d
print(min(tmp1, tmp2))
|
p03371 | s305610315 | Accepted | import math
line = input().split()
a = int(line[0])
b = int(line[1])
c = int(line[2])
x = int(line[3])
y = int(line[4])
m = max(x, y)
price = a * x + b * y
for i in range(1 ,m + 1):
tx = max(x - i, 0)
ty = max(y - i, 0)
tprice = i * 2 * c + a * tx + b * ty
if tprice < price:
price = tprice
print(price)
|
p03371 | s135225255 | Accepted | a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
print(a*x+b*y)
else:
if x>y:
ans=2*c*y
rem=x-y
ans+=min(2*rem*c,rem*a)
elif x<y:
ans=2*c*x
rem=y-x
ans+=min(2*rem*c,rem*b)
else:ans=2*c*x
print(ans) |
p03371 | s224193275 | Accepted | #ABC095C 全列挙
def main():
import sys, math
A,B,C,X,Y = map(int, sys.stdin.readline().split())
ans = float('inf')
for i in range(10**5+1):
tmp = i*2*C + max(0, (X-i)*A) + max(0, (Y-i)*B)
ans = min(tmp, ans)
if i > X and i > Y:
break
print(ans)
if __name__=='__main__':
main()
|
p03371 | s891849588 | Accepted | a,b,c,x,y=map(int,input().split())
ans=float('inf')
for i in range(10**5+1):
temp=i*2*c + max(0,x-i)*a +max(0,y-i)*b
ans=min(ans,temp)
print(ans) |
p03371 | s743741592 | Accepted | a, b, c, x, y = list(map(int, input().split()))
ans = 0
for i in range(0, max(x,y)+1):
s = a*max(0,x-i)+b*max(0,y-i)+c*2*i
if ans == 0:
ans = s
else:
ans = min(ans,s)
print(ans) |
p03371 | s795076788 | Accepted | a,b,c,x,y = map(int, input().split())
k1 = a*x+b*y
k2 = 2*c*max(x,y)
if x < y:
k3 = 2*c*min(x,y)+b*(y-x)
else:
k3 = 2*c*min(x,y)+a*(x-y)
print(min(k1, k2, k3)) |
p03371 | s704722124 | Accepted | a,b,c,x,y=map(int,input().split())
ans=1000000000
for i in range (0,(max(x,y)*2+1),2):#abピザを何枚買ったか考える。偶数枚しかありえないことに注意
price=c*i+a*(max(0,(x-int(i/2))))+b*(max(0,(y-int(i/2))))
ans =min(price,ans)
#abピザの枚数が決まると残りは単品による購入となるので、
#自動的に購入枚数は決定する。O(n)全探索で済むので間に合う。
print(ans) |
p03371 | s508279399 | Accepted |
def main():
A, B, C, X, Y = map(int, input().split())
M1 = A*X + B*Y
M2 = C*2*min(X, Y) + (Y >= X) * (Y - X) * B + (X > Y) * (X - Y) * A
M3 = C*2*max(X, Y)
ans = min(M1, M2, M3)
print(ans)
if __name__ == "__main__":
main()
|
p03371 | s676201050 | Accepted | a, b, c, x, y = map(int, input().split())
ans1 = a * x + b * y
ans2 = min(x, y) * 2 * c + [a, b][max(x, y) == y] * abs(x - y)
ans3 = max(x, y) * 2 * c
print(min(ans1, ans2, ans3)) |
p03371 | s294697882 | Accepted | a,b,c,x,y=map(int,input().split())
if (a+b)/2>c:
C=min(x,y)*2
if x>y:
if 2*c>a:
print(a*(x-y)+c*C)
else:
print(c*max(x,y)*2)
else:
if 2*c>b:
print(b*(y-x)+c*C)
else:
print(c*max(x,y)*2)
else:
print(a*x+b*y) |
p03371 | s488654451 | Accepted | def resolve():
a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
ans = min(ans, 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)
return
if __name__ == "__main__":
resolve()
|
p03371 | s300812561 | Accepted | a,b,c,x,y=map(int,input().split())
#全部ABピザで買う
ans1=c*max(x,y)*2
#AピザX個、BピザをY個、それぞれ買う
ans2=a*x+b*y
#X、Yの少ない方までABピザを買い、足りない分を買う
if(x<=y):
ans3=c*x*2+(y-x)*b
else:
ans3=c*y*2+(x-y)*a
print(min(ans1,ans2,ans3))
|
p03371 | s386622145 | Accepted | a, b, c, x, y = map(int, input().split())
mi, ma = min(x, y), max(x, y)
print(int(min(mi * c * 2 + a * (x-mi) + b * (y-mi),
ma * c * 2,
x * a + y * b))) |
p03371 | s856863761 | Accepted | from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)
a,b,c,x,y = map(int,stdin.readline().rstrip().split())
mi = 10**10
mi = min(mi,max(x,y)*2*c)
mi = min(mi,a*x+b*y)
if x >= y:
mi = min(mi,y*2*c+(x-y)*a)
else:
mi = min(mi,x*2*c+(y-x)*b)
print(mi) |
p03371 | s651966027 | Accepted | a,b,c,x,y = [int(x) for x in input().split()]
res = 0
if a + b > 2 * c:
res += min(x,y) * 2 * c
if x == min(x,y):
if b > 2 * c:
res += (y - min(x,y)) * 2 * c
else:
res += (y - min(x,y)) * b
else:
if a > 2 * c:
res += (x - min(x,y)) * 2 * c
else:
res += (x - min(x,y)) * a
else:
res += a * x
res += b * y
print(res) |
p03371 | s859700970 | Accepted | A,B,C,X,Y = map(int,input().split())
ans = 10**10
for k in range(max(X,Y)+1):
i = max((X-k),0)
j = max((Y-k),0)
price = A*i + B*j + C*2*k
ans = min(ans,price)
print(ans) |
p03371 | s705133215 | Accepted | A,B,AB,X,Y=map(int,input().split())
ans1=A*X+B*Y
ans2=2*AB*max(X,Y)
if X<Y:
ans3=2*AB*X+B*(Y-X)
else:
ans3=2*AB*Y+A*(X-Y)
print(min(ans1,ans2,ans3))
|
p03371 | s523669619 | Accepted | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import collections
a,b,c,x,y = map(int,input().split())
"""
AとBのみ
"""
cost = x*a + y*b
"""
ABと個数あわせ
"""
cost2 = c*2*min(x,y)
if x>y:
cost2 += (x-y)*a
else:
cost2 += (y-x)*b
"""
ABのみ
"""
cost3 = c*2*max(x,y)
ans = min(cost,cost2)
ans = min(ans,cost3)
print(ans)
|
p03371 | s845302352 | Accepted | a,b,c,x,y = map(int, input().split())
if a+b <= 2*c:
print(a*x + b*y)
else:
#買えるだけABピザを買う
z = min(x,y)
res = c * 2 * z
#残り
if x>=y:
cand1 = (x-z)*a
else:
cand1 = (y-z)*b
cand2 = (max(x,y)-z)*2*c
print(min(cand1,cand2) + res)
|
p03371 | s641513243 | Accepted | A, B, C, X, Y = map(int, input().split())
if A + B >= C * 2:
if X > Y:
ans = min((C * (Y * 2) + A * (X - Y)), C * X * 2)
else:
ans = min((C * (X * 2) + B * (Y - X)), C * Y * 2)
else:
ans = A * X + B * Y
print(ans) |
p03371 | s178889871 | Accepted | a, b, c, x, y = map(int,input().split())
total = []
for i in range(0, max(x, y) + 1):
c_price = i * 2 * c
if x - i <= 0:
a_price = 0
else:
a_price = (x - i) * a
if y - i <= 0:
b_price = 0
else:
b_price = (y - i) * b
total.append(a_price + b_price + c_price)
print(min(total))
|
p03371 | s578443519 | Accepted | import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**6)
for c in range(1+max([2*x,2*y])):
a=0
b=0
if x>c/2:
a=math.ceil(x-(c/2))
if y>c/2:
b=math.ceil(y-(c/2))
if A*a+B*b+C*c<price:
price=A*a+B*b+C*c
print(price) |
p03371 | s614239277 | 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 | s676911411 | Accepted | a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a >= 2 * c and b >= 2 * c:
print(2 * c * max(x,y))
elif a >= 2 * c and x >= y:
print(x * 2 * c)
elif a >= 2 * c and x < y:
print(x * 2 * c + (y - x) * b)
elif b >= 2 * c and x <= y:
print(y * 2 * c)
elif b >= 2 * c and x > y:
print(y * 2 * c + (x - y) * a)
elif a + b >= 2 * c and x >= y:
print(y * mix_price + (x - y) * a)
elif a + b >= 2 * c and x < y:
print(x * mix_price + (y - x) * b)
else:
print(x * a + y * b) |
p03371 | s052985356 | Accepted | a, b, c, x, y = map(int, input().split())
cost = float("inf")
for i in range(100001):
tc = c * i * 2 + max(a * (x - i), 0) + max(b * (y - i), 0)
cost = min(cost, tc)
print(cost) |
p03371 | s224068519 | Accepted | A, B, C, X, Y = map(int, input().split())
pizza = {X : A, Y : B}
ans = 0
for i in range(max(X, Y)):
if i <= min(X, Y) - 1:
ans += min(A + B, 2 * C)
else:
ans += min(pizza[max(X, Y)], 2 * C)
print(ans) |
p03371 | s488555263 | Accepted | a,b,c,x,y = map(int,input().split())
#貪欲で全てのケースを用意する。
ans = 0
ans += a*x + b*y
if x <= y:
s = x*c*2
m = (y-x)*b
ans = min(ans,s+m)
else:
s = y*c*2
m = (x-y)*a
ans = min(ans,s+m)
ans = min(ans,max(x,y)*c*2)
print(ans) |
p03371 | s543804526 | 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:
pass
elif x > y and a < 2 * c:
ans += a * (x - y)
elif x < y and b < 2 * c:
ans += b * (y - x)
else:
ans += 2 * c * abs(x - y)
else:
ans = a * x + b * y
print(ans)
|
p03371 | s155932038 | Accepted | a,b,c,x,y=map(int,input().split())
print(min(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)),a*x+b*y)) |
p03371 | s108801221 | Accepted | A, B, C, X, Y = map(int, input().split())
inf = float('inf')
amount = inf
for i in range(100001):
amount = min(amount, 2*C*i + max(0, A*(X-i)) + max (0, B*(Y-i)))
print(amount) |
p03371 | s087937208 | Accepted | A, B, C, X, Y = map(int, input().split())
ans = 0
if A + B >= 2 * C:
AB = min(X, Y)
ans += 2 * AB * C
X -= AB
Y -= AB
if A >= 2 * C:
AB = X
ans += 2 * X * C
X -= AB
Y -= AB
if B >= 2 * C:
AB = Y
ans += 2 * Y * C
X -= AB
Y -= AB
ans += A * max(0, X)
ans += B * max(0, Y)
print(ans) |
p03371 | s244206976 | Accepted | A, B, C, X, Y = list(map(int, input().split()))
ans = 0
if A + B > 2 * C:
z = min(X, Y)
X -= z
Y -= z
ans += 2 * z * C
# 偏り分
if 2 * C < A:
k = X
X -= k
Y -= k
ans += 2 * C * k
if 2 * C < B:
k = Y
X -= k
Y -= k
ans += 2 * C * k
# あまり分
ans += A * max(0, X) + B * max(0, Y)
print(ans) |
p03371 | s216371110 | Accepted | def LI(): return list(map(int,input().split()))
A,B,C,X,Y = LI()
ans = float('INF')
for i in range(max(X,Y)+1):
price = A*max(X-i,0)+B*max(Y-i,0)+C*2*i
ans = min(price,ans)
print(ans)
|
p03371 | s603003962 | Accepted | a, b, c, x, y = map(int,input().split())
ans = max(x,y)*2*c
s = max(x,y)
while s:
tmp = 0
tmp -= c*2
s -= 1
if x > s:
tmp += a
if y > s:
tmp += b
if tmp > 0:
print(ans)
exit()
else:
ans += tmp
print(ans) |
p03371 | s100313768 | Accepted | def main():
a, b, ab, x, y = map(int, input().split())
# abをx枚買うかy枚買うか、0枚買うかの3パターン
ab *= 2
ab_x = ab * x + b * max((y - x), 0)
ab_y = ab * y + a * max((x - y), 0)
ab_0 = a * x + b * y
print(min(ab_x, ab_y, ab_0))
if __name__ == "__main__":
main()
|
p03371 | s935169482 | Accepted | import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
def main():
A, B, C, X, Y = map(int, input().split())
money = []
money.append(X * A + Y * B)
if X > Y:
money.append(X * 2 * C)
money.append(Y * 2 * C + (X - Y) * A)
elif X == Y:
money.append(X * 2 * C)
else:
money.append(Y * 2 * C)
money.append(X * 2 * C + (Y - X) * B)
print(min(money))
if __name__ == "__main__":
main()
|
p03371 | s825411470 | Accepted | A,B,C,X,Y = map(int,input().split())
price = X * A + Y * B
for a in [0,abs(X-Y),X]:
for b in [0,abs(X-Y),Y]:
c = max(X-a,Y-b)*2
price = min(price,a*A + b*B + c*C)
print(price) |
p03371 | s505445156 | Accepted | a, b, c, x, y = map(int, input().split())
same = 0
diff = 0
if x>y:
diff=min(a*(x-y), 2*c*(x-y))
same = y
elif y>x:
diff=min(b*(y-x), 2*c*(y-x))
same = x
else:
same = x
print(min((a+b)*same, 2*c*same) + diff) |
p03371 | s709841134 | Accepted | a,b,c,x,y=map(int,input().split())
z=min(x,y)
z_max=max(x,y)
cost=0
if a+b > 2*c:
cost=min(2*c*z+a*(x-z)+b*(y-z),
2*c*z_max)
else:
cost=a*x + b*y
print(cost) |
p03371 | s412268113 | Accepted | a, b, c, x, y = map(int, input().split())
ans = float("inf")
for k in range(0, max(x, y)*2+1, 2):
i = 0 if x-k//2 < 0 else x-k//2
j = 0 if y-k//2 < 0 else y-k//2
ans = min(ans, a*i+b*j+c*k)
print(ans)
|
p03371 | s048695218 | Accepted | A, B, C, X, Y = map(int, input().split())
if C*2>=A+B:
ans = A*X+B*Y
else:
ans = min(C*2*max(X,Y),C*2*min(X,Y)+A*max(0,X-Y)+B*max(0,Y-X))
print(ans) |
p03371 | s945314173 | Accepted | A,B,C,X,Y=map(int,input().split())
key=A/2+B/2
if C>=key:
print(A*X+B*Y)
else:
if X>=Y:
Key=X-Y
if Key*C*2<=Key*A:
print(C*2*X)
else:
print(C*2*Y+A*Key)
else:
Key=Y-X
if Key*C*2<=Key*B:
print(C*2*Y)
else:
print(C*2*X+B*Key) |
p03371 | s069197122 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 2000000000
if x >= y:
cnt = 0
cnt += y * 2 * c
cnt += (x - y) * a
ans = min(ans,cnt)
else:
cnt = 0
cnt += x * 2 * c
cnt += (y - x) * b
ans = min(ans,cnt)
ans = min(ans, a * x + b * y)
ans = min(ans, max(x,y) * 2 * c)
print(ans) |
p03371 | s836252506 | Accepted | a,b,c,x,y=map(int,input().split())
ans=712378627461242
for i in range(0,2*max(x,y)+1,2):
mai=max(0,x-i//2)
mbi=max(0,y-i//2)
ans=min(ans,a*mai+b*mbi+c*i)
print(ans) |
p03371 | s487061138 | Accepted | a, b, c, x, y = [int(w) for w in input().split()]
if 2 * c >= a + b:
ans = a * x + b * y
else:
cnum = min(x, y) * 2
less = abs(x - y)
p = a if x > y else b
if 2 * c < p:
cnum += 2 * less
less = 0
ans = c * cnum + less * p
print(ans)
|
p03371 | s975217339 | 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, 2 * c * y + a * (x - y))
else:
ans = min(ans, 2 * c * x + b * (y - x))
print(ans) |
p03371 | s763659238 | Accepted | a,b,c,x,y = map(int,input().split())
ans = 10000000000000000000000000000
for i in range(max(x,y)+1):
price = 2*i*c + max(0,x-i)*a + max(0,y-i)*b
if ans > price:
ans = price
else:
continue
print(ans) |
p03371 | s392990990 | Accepted | a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
print(a*x+b*y)
else:
print(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y))) |
p03371 | s741806003 | Accepted | a,b,c,x,y = map(int, input().split())
ans=10**10
for i in range(0,max(x,y)*2+1,2):
sm=c*i
if x-i/2>0:
sm+=a*(x-i/2)
if y-i/2>0:
sm+=b*(y-i/2)
ans=min(ans,sm)
print(int(ans))
|
p03371 | s558445598 | Accepted | A,B,AB,X,Y = map(int,input().split())
ans = min(X,Y)*min(2*AB, A+B)
cnt_A = min(X,Y)
cnt_B = min(X,Y)
#残り
if X > cnt_A:#Aが足りないときa
ans += min(2*AB,A)*(X-cnt_A)
else:#Bが足りないとき
ans += min(2*AB,B)*(Y-cnt_B)
print(ans) |
p03371 | s559381807 | Accepted | import sys
sys.setrecursionlimit(10000)
def resolve():
A, B, C, X, Y = list(map(int, input().split(" ")))
if A + B < 2 * C:
print(A*X+B*Y)
return
if X < Y:
m = min((Y-X)*B, 2*(Y-X)*C)
print(2*X*C+m)
return
else:
m = min((X-Y)*A, 2*(X-Y)*C)
print(2*Y*C+m)
return
if '__main__' == __name__:
resolve() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.