QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#755112#9552. The Chariotucup-team3661#WA 20ms10828kbPython3905b2024-11-16 16:29:412024-11-16 16:29:41

Judging History

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

  • [2024-11-16 16:29:41]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:10828kb
  • [2024-11-16 16:29:41]
  • 提交

answer

inf = float('inf')

import sys
input = sys.stdin.readline

T = int(input())

for _ in range(T):
	A,B,C,X,Y,D = map(int, input().split())

	ans = inf

	#all A
	res = ((D+X-1)//X) * A
	ans = min(ans, res)

	#X, X, .. (A,B,C)
	cnt = D//X
	res = cnt*A
	if cnt > 0:
		rem = D - cnt*X
		if rem <= Y:
			res += B*rem
		else:
			res += B*Y
			rem -= Y
			res += C*rem
		ans = min(ans, res)

	#no use C
	Cx = D//X
	R = D%X
	Cy = (R+Y-1)//Y
	if Cx >= Cy:
		res = Cx*A + Cy*B
		ans = min(ans, res)

	#(X+Y), (X+Y), ... (A,B)
	Z = X+Y
	P = A + Y*B
	cnt = D//Z
	rem = D%Z
	res = cnt*P
	if rem <= X:
		res += A
	else:
		res += A
		res += (rem-X) * B
	ans = min(ans, res)

	#(X+Y), ... (A,B,C)
	if cnt > 0:
		res = cnt*P
		res += rem*C
		ans = min(ans, res)

	#all (A,B,C)
	if D>=Z:
		res = P
		rem = D-Z
		res += rem*C
		ans = min(ans, res)
	
	print(ans)

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 10588kb

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: 20ms
memory: 10828kb

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
336
57
29
561
300
15
41
312
21
69
46
136
150
104
97
626
76
32
86
152
39
138
36
605
30
23
88
76
201
20
330
284
160
128
32
36
1
36
30
24
190
170
17
59
83
102
94
86
52
81
25
44
8
21
180
49
51
145
55
82
31
85
136
70
133
21
84
48
156
51
145
162
156
86
2
73
83
5
143
117
44
6
152
58
122
26
57...

result:

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