結果
| 問題 |
No.967 引き算をして門松列(その2)
|
| コンテスト | |
| ユーザー |
r_ishida
|
| 提出日時 | 2020-01-31 07:28:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 142 ms / 2,000 ms |
| コード長 | 796 bytes |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-17 06:44:47 |
| 合計ジャッジ時間 | 1,926 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 |
ソースコード
def cost102(a, b, c, x, y, z):
ret = 0
if c <= a:
ret += (a-c+1)*x
a = c-1
if a <= b:
ret += (b - a + 1) * y
b = a-1
if a<1 or b<1 or c<1:
ret = 10**20
return ret
def cost120(a, b, c, x, y, z):
ret = 0
if b <= a:
ret += (a-b+1)*x
a = b-1
if a <= c:
ret += (c - a + 1) * z
c = a-1
if a<1 or b<1 or c<1:
ret = 10**20
return ret
t = int(input())
for _ in range(t):
a,b,c,x,y,z = map(int,input().split())
cost = []
cost.append(cost120(a, b, c, x, y, z))
cost.append(cost120(c, b, a, z, y, x))
cost.append(cost102(a, b, c, x, y, z))
cost.append(cost102(c, b, a, z, y, x))
if min(cost) == 10**20:
print(-1)
else:
print(min(cost))
r_ishida