結果
| 問題 |
No.966 引き算をして門松列(その1)
|
| コンテスト | |
| ユーザー |
simamumu
|
| 提出日時 | 2020-01-13 20:36:07 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,004 bytes |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,776 KB |
| 最終ジャッジ日時 | 2024-12-21 16:22:55 |
| 合計ジャッジ時間 | 1,040 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 2 WA * 3 |
ソースコード
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
T = inp()
for _ in range(T):
A,B,C = inpl()
if max(A,B,C) <= 2 or (A==1 and B<=2) or (B<=2 and C==1):
ans = -1
else:
ans = INF
if A == B == C:
if A >= 3:
ans = 3
else:
ans = -1
elif A <= B <= C:
if A > 1:
ans = min(ans,B-A+1)
if B > 1:
ans = min(ans,C-B+1)
elif A >= B >= C:
if C > 1:
ans = min(ans,B-C+1)
if B > 1:
ans = min(ans,A-B+1)
else:
ans = 0
if ans == INF:
print(-1)
else:
print(ans)
simamumu