結果
問題 | No.967 引き算をして門松列(その2) |
ユーザー |
|
提出日時 | 2020-06-13 13:17:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 202 ms / 2,000 ms |
コード長 | 320 bytes |
コンパイル時間 | 124 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-25 01:42:17 |
合計ジャッジ時間 | 2,429 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
ソースコード
#yuki967 t=int(input()) for x in range(t): a=list(map(int,input().split())) res=float('inf') for i,j,k in [(0,2,1),(1,2,0),(1,0,2),(2,0,1)]: t1=max(a[j]-a[i]+1,0) aj= a[j]-t1 t2=max(a[k]-aj+1,0) ak= a[k]-t2 if ak>0: res=min(res,t1*a[j+3]+t2*a[k+3]) if res==float('inf'): print(-1) else: print(res)