結果
| 問題 |
No.968 引き算をして門松列(その3)
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-04-21 16:17:00 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 648 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-13 15:13:19 |
| 合計ジャッジ時間 | 3,067 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | WA * 10 |
ソースコード
import itertools
T=int(input())
inf=1<<60
for t in range(T):
A,B,C,Z,Y,X=map(int,input().split())
ans=inf
for tpl in itertools.permutations(range(3)):
if tpl[1]==1:
continue
ABC=[A,B,C]
for i,j in zip(tpl,tpl[1:]):
ABC[j]=max(ABC[j],ABC[i]+1)
cnt=[a-aa for a,aa in zip(ABC,(A,B,C))]
ABC=[A,B,C]
for i in range(3):
for j in range(3):
if i==j:
continue
ABC[j]-=cnt[i]
if min(ABC)>0:
ans=min(ans,sum(c*x for c,x in zip(cnt,(X,Y,Z))))
if ans==inf:
ans=-1
print(ans)
vwxyz