QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#867558 | #9552. The Chariot | qmqcbhc | WA | 15ms | 8960kb | Python3 | 1.4kb | 2025-01-23 19:02:24 | 2025-01-23 19:02:24 |
Judging History
answer
def solve():
a,b,c,x,y,d=map(int,input().split())
t1=(d+x-1)//x #全程A
t2=t1-1 #前半程A,收尾b
if(x>=d):
return a
elif(x+y>=d):
return min(a*t1,a*t2+b*(d-t2*x),a+b*(d-x))
else:
v1=a/x #A均价
v2=(a+b)/(x+y) #A+B均价
v3=c #C均价
#print(f"v1{v1} v2{v2} v3{v3}")
if(v3==min(v1,v2,v3)):
ans1=min(a+b*y+c*(d-x-y),a*t1)
if(t2*(x+y)>=d):#t2组x+y中能到达终点
ans2=a*t2+b*(d-t2*x)
else:
ans2=(a+b)*t2+c*(d-t2*(x+y))
return min(ans1,ans2)
elif(v2==min(v1,v2,v3)):
t3=(d+(x+y)-1)//(x+y)
t4=t3-1
t5=((d-t4*(x+y))+x-1)//x
d1=t4*y
d2=t4*(x+y)+x*t5-d
ans1=min(a*t4+b*t4*y+c*(d-t4*(x+y)), a*t4+b*t4*y+a*t5-b*min(d1,d2))
if (d-t4*(x+y)>x):
ans1=min(ans1,a*t4+b*t4*y+a+b*(d-t4*(x+y)-x))
return ans1
else:
ans1=a*t1
if(d-x*t2-y>0):
ans1=min(ans1,a*t2+b+c*(d-x*t2-y))
if((x+y)*t2>=d):
ans1=min(ans1,a*t2+b*(d-t2*x))
else:
ans1=min(ans1,a*t2+b*t2*y+c*(d-(x+y)*t2))
return ans1
if __name__ == "__main__":
T=int(input())
for _ in range(T):
print(solve())
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 10ms
memory: 8960kb
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: 15ms
memory: 8960kb
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 4 310 114 400 57 29 561 2490 15 62 2246 21 76 48 192 150 130 97 804 76 32 112 180 39 138 36 605 30 23 88 76 285 20 330 867 174 128 32 36 1 36 30 24 192 170 17 88 83 102 140 86 52 81 25 44 8 21 180 49 51 145 55 82 31 85 156 70 158 21 84 48 156 51 145 174 156 86 2 73 83 5 200 117 44 6 152 58 122 2...
result:
wrong answer 9th lines differ - expected: '300', found: '2490'