結果

問題 No.966 引き算をして門松列(その1)
ユーザー simamumusimamumu
提出日時 2020-01-13 20:36:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,004 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 10,420 KB
最終ジャッジ日時 2023-08-23 13:06:38
合計ジャッジ時間 1,095 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,028 KB
testcase_01 AC 29 ms
10,040 KB
testcase_02 AC 29 ms
10,008 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 61 ms
10,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0