QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#753966 | #9552. The Chariot | ucup-team4893# | WA | 254ms | 10708kb | Python3 | 844b | 2024-11-16 13:57:34 | 2024-11-16 13:57:35 |
Judging History
answer
def work():
a,b,c,x,y,d = input().split()
a,b,c,x,y,d = int(a),int(b),int(c),int(x),int(y),int(d)
ans = pow(10, 10000)
ans = min(ans, ((d+x-1)//x) * a)
tmp = d // (x + y)
if d % (x + y) >= x:
ans = min(ans, tmp * (a + y * b) + a + (d % (x + y) - x) * b)
else :
ans = min(ans, tmp * (a + y * b) + a)
s = a
d -= x
if d < 0:
return
if d <= y:
ans = min(ans, s + d * b)
print(ans)
return
if d % x <= d // x * y + y :
ans = min(ans, s + (d // x) * a + (d % x) * b)
s += b * y
d -= y
ans = min(ans, s + d * c)
ans = min(ans, s + (d % x) * c + (d // x) * a)
ans = min(ans, s + (d % (x + y)) * c + (d // (x + y)) * (a + y * b))
print(ans)
T = int(input())
for i in range(0, T):
work()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 15ms
memory: 10588kb
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 10000000000099799
result:
ok 5 lines
Test #2:
score: -100
Wrong Answer
time: 254ms
memory: 10708kb
input:
2077 63 88 64 47 55 88 4 75 38 53 33 41 41 1 28 6 13 100 57 88 77 35 5 48 100 36 97 24 93 87 57 25 26 84 62 18 29 11 33 88 86 71 33 16 7 4 73 68 50 65 72 14 43 78 15 31 72 42 39 29 31 10 76 58 35 89 39 55 99 11 16 82 21 18 57 44 80 16 38 31 99 58 59 69 24 22 69 76 14 83 96 40 56 31 14 36 75 84 27 57...
output:
126 311 114 400 561 300 62 312 76 48 192 150 130 636 112 186 138 36 605 88 285 330 325 174 128 32 36 24 192 170 17 88 102 140 86 180 145 156 70 192 21 48 156 145 174 156 200 117 44 6 152 122 154 180 201 126 256 348 10 132 84 116 624 288 81 36 118 913 24 54 448 558 342 150 600 40 184 42 22 188 120 70...
result:
wrong answer 2nd lines differ - expected: '4', found: '311'