結果

問題 No.966 引き算をして門松列(その1)
ユーザー zer0zer0
提出日時 2020-01-13 21:08:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 802 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 10,900 KB
最終ジャッジ日時 2023-08-24 13:39:57
合計ジャッジ時間 975 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

T = int(input())
abclst = [list(map(int, input().split())) for _ in range(T)]

for i in range(T):
    maxt = max(abclst[i])
    mint = min(abclst[i])
    midt = 0
    ans = -1
    if abclst[i].count(abclst[i][0]) == 3:
        if abclst[i][0] >= 3:
            print(3)
        else:
            print(-1)
        continue
    for j in range(3):
        if abclst[i][j] != maxt and abclst[i][j] != mint:
            midt = abclst[i][j]
            if j == 0 or j == 2:
                ans = 0
            break
    if ans == 0:
        print(ans)
    else:
        tmp1 = maxt - midt + 1
        if maxt - tmp1 == mint:
            tmp1 += 1
        if maxt - tmp1 > 0:
            ans = tmp1
        tmp2 = midt - mint + 1
        if midt - mint > 0:
            ans = min(ans, tmp2)
        print(-1)
0