結果
| 問題 | No.2309 [Cherry 5th Tune D] 夏の先取り |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-08-02 22:14:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 187 ms / 3,000 ms |
| + 996µs | |
| コード長 | 1,356 bytes |
| 記録 | |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 96,104 KB |
| 実行使用メモリ | 85,564 KB |
| 最終ジャッジ日時 | 2026-08-02 22:14:14 |
| 合計ジャッジ時間 | 9,300 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
from sys import stdin
input = stdin.readline
def func(a, b, c, ab, ac):
ans = 0
if ab < ac:
b, c = c, b
ab, ac = ac, ab
MIN = min(a, b)
a -= MIN
b -= MIN
ans += MIN*ab
MIN = min(a, c)
a -= MIN
c -= MIN
ans += MIN*ac
return ans
for _ in range(int(input())):
A, B, C = map(int, input().split())
X, Y, Z, W = map(int, input().split())
ans = 0
for i in range(min(A, B, C)+1):
a, b, c = A-i, B-i, C-i
SUM = W*i
if i <= 1:
for j in range(min(a, b)+1):
d, e, f = a-j, b-j, c
SUM2 = SUM+X*j
if Z <= Y:
MIN = min(e, f)
e -= MIN
f -= MIN
SUM2 += Y*MIN
MIN = min(d, f)
d -= MIN
f -= MIN
SUM2 += Z*MIN
else:
MIN = min(d, f)
d -= MIN
f -= MIN
SUM2 += Z*MIN
MIN = min(e, f)
e -= MIN
f -= MIN
SUM2 += Y*MIN
ans = max(ans, SUM2)
else:
ans = max(ans, SUM+max(func(a, b, c, X, Z), func(b, a, c, X, Y), func(c, a, b, Z, Y)))
print(ans)
detteiuu