QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#755176#9552. The Chariotucup-team133#WA 16ms11268kbPython31.1kb2024-11-16 16:37:262024-11-16 16:37:26

Judging History

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

  • [2024-11-16 16:37:26]
  • 评测
  • 测评结果:WA
  • 用时:16ms
  • 内存:11268kb
  • [2024-11-16 16:37:26]
  • 提交

answer

import sys,time

from itertools import permutations
from heapq import heappop,heappush
from collections import deque
import random
import bisect
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

def solve(A,B,C,X,Y,D):
    """
    全部Aで済ませる
    """
    res = (D+X-1)//X * A

    """
    A,Bで済ませる
    """
    lower = max(1,(D+X+Y-1)//(X+Y))
    upper = D//X
    for k in (lower,upper):
        tmp_cost = k * A + B * (D - k * X)
        res = min(res,tmp_cost)

    """
    (X+Y)m フルに使う
    """
    k_max = D//(X+Y)
    for k in (1,k_max):
        if 1 <= k <= k_max:
            tmp_cost = k * (A+B*Y) + C * (D-k*(X+Y))
            res = min(res,tmp_cost)

    """
    Xmだけ走って最後だけ全部使う
    """
    k_max = (D-Y-X)//X
    for k in (0,k_max):
        if 0 <= k <= k_max:
            tmp_cost = (k+1) * A + B*Y + C * (D-k*X-X-Y)
            res = min(res,tmp_cost)

    
    
    return res

for _ in range(int(input())):
    A,B,C,X,Y,D = mi()
    print(solve(A,B,C,X,Y,D))



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 11216kb

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: 16ms
memory: 11268kb

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
-896
310
-1822
400
-1593
-158
561
300
-388
62
312
-483
76
48
192
150
130
-5777
636
-4248
-205
112
180
-55
138
36
605
-866
-817
88
-4460
285
-5680
330
325
174
128
32
36
-2009
-4374
-1374
24
192
170
17
88
-1072
102
140
-3106
-578
52
-599
-3673
-1360
-357
180
-3617
-3027
145
-3175
-8
-567
-1724
156...

result:

wrong answer 2nd lines differ - expected: '4', found: '-896'