QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783740 | #9552. The Chariot | Inkyo | WA | 11ms | 10600kb | Python3 | 835b | 2024-11-26 11:36:24 | 2024-11-26 11:36:34 |
Judging History
answer
t = int(input())
for i in range(t):
a, b, c, x, y, d = map(int, input().split())
def cost(dis):
if dis <= 0:
return 0
elif dis <= x:
return a
elif dis <= x + y:
return a + (dis - x) * b
else:
return a + b * y + (dis - x - y) * c
cx = d // x
ans = cx * cost(x) + cost(d % x)
if d % x <= cx * y:
ans = min(ans, cx * cost(x) + d % x * b)
else:
ans = min(ans, cx * cost(x) + cx * y * b + (d % x - cx * y) * c)
cxy = d // (x + y)
ans = min(ans, cxy * cost(x + y) + cost(d % (x + y)))
if d > x + y:
ans = min(ans, cxy * cost(x + y) + (d % (x + y)) * c)
cxyp = (d + x + y - 1) // (x + y)
ans = min(ans, cxyp * a + max(d - cxyp * x, 0) * b)
print(ans)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 11ms
memory: 10600kb
input:
5 160 27 41 3 12 3 160 27 41 3 12 4 160 27 41 3 12 99 1 999 999 1 99 999 999 999 1 1 99 9999999999999999
output:
160 187 3226 999 9989999999999900199
result:
wrong answer 5th lines differ - expected: '10000000000099799', found: '9989999999999900199'