QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#812152#9552. The ChariotmmzskmWA 22ms10748kbPython3933b2024-12-13 12:01:462024-12-13 12:01:47

Judging History

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

  • [2024-12-13 12:01:47]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:10748kb
  • [2024-12-13 12:01:46]
  • 提交

answer

def solve():
    a,b,c,x,y,d = map(int, input().split())
    d1 = d % x
    d2 = d % (x + y)
    if d <= x:
        return a
    if x < d <= x + y:
        return min(d // x * a + min(a, d1 * b), a + (d - x) * b)
    if d > x + y:
        r1 = a + y * b + (d - x - y) * c
        r2 = d // x * a
        if d1:
            if b <= c:
                if d1 <= d // x * y:
                    r2 += min(a, d1 * b)
                else:
                    r2 += min(a, d // x * y * b + (d1 - d // x * y) * c)
            else:
                r2 += min(a, b * min(d1, y) + max(0, d1 - y) * c)
        r3 = d // (x + y) * (a + b * y)
        if d2:
            if d2 <= x:
                r3 += min(d2 * c, a - min(d // (x + y) * y, (x - d2) * b))
            else:
                r3 += min(d2 * c, a + (d2 - x) * b)
        return min(r1, r2, r3)


T = eval(input())
for i in range(T):
    print(solve())

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 10712kb

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: 0
Accepted
time: 18ms
memory: 10632kb

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
300
15
62
312
21
76
48
192
150
130
97
636
76
32
112
180
39
138
36
605
30
23
88
76
285
20
330
325
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
26
...

result:

ok 2077 lines

Test #3:

score: 0
Accepted
time: 22ms
memory: 10620kb

input:

2077
4 2 6 3 5 3
6 6 9 5 1 4
6 5 6 8 7 8
5 6 2 6 5 9
3 6 4 7 7 6
10 6 4 9 3 8
8 2 7 1 2 9
9 10 1 5 7 3
10 7 10 2 5 9
10 8 6 10 7 7
2 3 2 9 9 2
8 5 6 8 6 2
6 9 2 10 2 6
3 5 10 5 2 5
5 2 4 5 4 4
2 8 6 10 4 4
6 7 3 10 2 8
5 3 3 9 6 7
5 3 9 4 7 3
8 10 8 10 4 4
4 9 7 9 3 10
9 9 8 4 1 1
9 10 8 6 7 1
6 5 1...

output:

4
6
6
10
3
10
36
9
47
10
2
8
6
3
5
2
6
5
5
8
8
9
9
6
13
10
28
13
3
10
9
4
8
32
9
23
27
11
16
4
19
10
15
3
5
8
3
20
1
8
5
1
73
6
7
5
9
9
16
20
6
9
1
1
2
1
3
24
2
7
12
3
30
12
9
8
25
14
10
21
10
6
4
8
5
9
10
3
14
10
8
17
8
10
2
6
5
4
18
1
13
6
10
2
14
3
4
10
24
3
8
7
9
1
9
6
4
10
4
4
20
10
6
2
4
14
2
...

result:

ok 2077 lines

Test #4:

score: 0
Accepted
time: 22ms
memory: 10536kb

input:

2077
1417 6409 9808 8816 7324 8530
5662 460 4915 2005 2448 7568
2364 6496 4478 9681 3398 4981
209 5212 2936 6744 841 7952
1624 4340 1128 7953 629 822
8548 8999 6702 1024 8649 3885
5481 6872 8501 3410 8413 7190
4763 2043 1656 4873 6240 1807
7865 5379 9761 4618 3415 3368
4091 5946 3144 3012 6738 4325
...

output:

1417
22648
2364
418
1624
34192
16443
4763
7865
8182
3254
7443
86816
7163
7657
34604
7606
3257
3033
18189
3225
17562
7560
14346
26664
14046
9261
29724
8342
5908
7590
17668
8738
8309
12168
7047
40800
9192
18648
9195
8935
8819
1969
6080
14334
6511
9074
419
7982
4578
9693
11504
20433
2097046
6050
3431
9...

result:

ok 2077 lines

Test #5:

score: 0
Accepted
time: 7ms
memory: 10728kb

input:

100
35536173063230675474372606727057241871490558788794679195579356708141439871609632246 61501577129508313030285232710985015233972816339881035444668942634613530833743277701 69977916214375545701616716206226956278311775009117120846318542023125616332108000926 10050605559008930496140983766520146625049146...

output:

319825557569076079269353460543515176843415029099152112760214210373272958844486690214
450560525702174822675186703542069011573945860191648382960759195841400159544341224669
95330623252648094277257142015852094363067783723454076033290618532125267190925051
1777633606276319797578182384890019944082898623010...

result:

ok 100 lines

Test #6:

score: 0
Accepted
time: 15ms
memory: 10748kb

input:

100
27617223436350200283167612380427755086919233236220002664283192538263695236207991904 24208495979381798085875453581540557535168142482714452392350977196830285412065557639 58564524392293912103986330932367021242171363180777480593317714805582101784998460630 76615895837656212115270200095047400796915042...

output:

27617223436350200283167612380427755086919233236220002664283192538263695236207991904
87292880408308830696242450650003813718392417734570796139825586196653804148504332324
2243643448060891488969234170818908126849228932280094041884548577352094675056317608
6865459361426655168544467745969250961734474493686...

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 19ms
memory: 10584kb

input:

2077
4860 9866 1167 236 7596 3197
4841 3579 8767 6961 1376 6810
9064 9416 6529 7179 7687 5921
5891 483 7844 4300 6619 1692
9091 3274 7728 9861 6360 3561
7750 4744 2863 9293 4259 3631
7838 5643 2250 972 3922 2905
2776 470 2103 9431 6128 4521
2244 8597 8546 9802 715 6745
4589 2626 4956 6382 9098 8342
...

output:

68040
4841
9064
5891
9091
7750
23514
2776
2244
9178
1191
8970
15234
2416
16486
4504
190
1526
5658
13210
5763
4604
894
3305
6806
6086
8197
66220
842
62220
11602
27207
401
12384
4911
7390
8172
7552
4646
8345
9696
9255
1445
7013
962000
12070
7178
6434
106800
11097
4916
18786
4708
191912
6747
25700
9512...

result:

ok 2077 lines

Test #8:

score: -100
Wrong Answer
time: 18ms
memory: 10708kb

input:

755
3929471836 62694 62695 62677 5808 20545488
848791 4613 4615 184 67808 128804
1712405854 91504 91506 18714 11361 9394425
1333207361 89405 89406 14912 59861 64977749
4168649572 76662 76660 54377 18493 7939044
7470761760 76482 76484 97680 3098 89084152
7427490330 77327 77329 96053 42847 111536698
5...

output:

1288078824018
594172152
859627464198
5809335650226
608607258778
6813334113264
8624798245085
516154678076
1554543417367
679601914588
1225389951605
74935221524
3695533644224
3800878040617
2470941963256
3628010083143
7377949269202
299612721670
1806371323009
1356913708574
4917313846071
1405638747628
201...

result:

wrong answer 4th lines differ - expected: '5809335650215', found: '5809335650226'