QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#769346#9552. The ChariotTreeQwQ#WA 12ms10780kbPython31.2kb2024-11-21 17:14:332024-11-21 17:14:33

Judging History

This is the latest submission verdict.

  • [2024-11-21 17:14:33]
  • Judged
  • Verdict: WA
  • Time: 12ms
  • Memory: 10780kb
  • [2024-11-21 17:14:33]
  • Submitted

answer

from math import *


def solve():
    a, b, c, x, y, d = map(int, input().split())

    res0 = a * ceil(d / x)

    if a <= b and a <= c:
        print(res0)
        return

    if c <= a and c <= b:
        res1 = a
        rem = d - x
        if rem > 0:
            res1 = res1 + b * min(rem, y)
            rem = rem - y
            if rem > 0:
                res1 = res1 + rem * c
        res2 = a * ceil(d / x)
        print(min(res1, res2))
        return

    z = x + y
    e = a + y * b
    if c >= a:
        res = e * floor(d / z)
        rem = d % z
        if rem > 0:
            res = res + a
            rem = rem - x
            if rem > 0:
                res = res + rem * b
        print(res)
    else:
        k = x * c + y * c - a - b * y
        res1 = a
        rem = d - x
        if rem > 0:
            res1 = res1 + b * min(rem, y)
            rem = rem - y
            if rem > 0:
                res1 = res1 + rem * c
        res = e * floor(d / z)
        rem = d % z
        if rem > 0:
            res = res + a
            rem = rem - x
            if rem > 0:
                res = res + rem * b
        print(min(res1, res))


t = int(input())
for i in range(0, t):
    solve()

詳細信息

Test #1:

score: 100
Accepted
time: 12ms
memory: 10652kb

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: 12ms
memory: 10780kb

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
311
114
2368
57
29
561
300
15
341
312
21
379
178
296
150
130
97
852
76
32
146
186
39
680
36
605
30
23
88
76
292
20
330
1306
1216
128
32
36
1
36
30
24
192
170
17
224
83
102
166
86
52
81
25
44
8
21
180
49
51
145
55
82
31
85
156
70
239
21
84
48
156
51
145
174
156
86
2
73
83
5
200
579
44
6
152
58
...

result:

wrong answer 3rd lines differ - expected: '310', found: '311'