QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#867640#9552. The ChariotqmqcbhcRE 6ms8960kbPython31.2kb2025-01-23 20:52:532025-01-23 20:52:55

Judging History

你现在查看的是最新测评结果

  • [2025-01-23 20:52:55]
  • 评测
  • 测评结果:RE
  • 用时:6ms
  • 内存:8960kb
  • [2025-01-23 20:52:53]
  • 提交

answer

def solve():
    a,b,c,x,y,d=map(int,input().split())
    t1=(d+x-1)//x #全程A
    t2=t1-1 #前半程A,收尾b
    t3=(d+(x+y)-1)//(x+y)
    t4=t3-1    
    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*y)/(x+y) #A+B均价
        v3=c #C均价
        #print(f"v1{v1} v2{v2} v3{v3}")
        if(v1==min(v1,v2,v3)):
            ans=t1*a
            ans1=t2*a+min(t2*y,d-t2*x)*b+(d-t2*x-min(t2*y,d-t2*x))*c
            ans2=t2*a+min(y,d-t2*x)*b+(d-t2*x-min(y,d-t2*x))*c
            return min(ans,ans1,ans2)
        elif(v2==min(v1,v2,v3)):
            if(d-t4*(x+y)>=x):
                ans=t3*a+(d-t3*x)*b
            t5=t4+((d-t4*(x+y)+x-1)//x)
            ans=min(ans,t5*a+t4*y*b-min(t4*y,(t5*x+t4*y-d))*b)
            ans=min(ans,t4*a+t4*y*b+(d-t4*(x+y))*c)
            return ans
        else:
            ans=t1*a
            ans1=t2*a+min(t2*y,d-t2*x)*b+(d-t2*x-min(t2*y,d-t2*x))*c
            ans2=a+y*b+(d-x-y)*c
            return min(ans,ans1,ans2)

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: 6ms
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
Runtime Error

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

result: