結果

問題 No.966 引き算をして門松列(その1)
ユーザー vwxyzvwxyz
提出日時 2024-04-19 15:57:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-19 15:57:45
合計ジャッジ時間 936 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,880 KB
testcase_01 AC 26 ms
10,880 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 86 ms
10,752 KB
testcase_05 AC 95 ms
10,880 KB
testcase_06 AC 125 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
inf=1<<60
for t in range(T):
    A,B,C=map(int,input().split())
    s=0
    if A==C:
        s+=1
        C-=1
    if A>C:
        A,C=C,A
    ans=inf
    if A>=2:
        ans=min(ans,max(B-A+1,0)+s)
    if B>=3 and C>=2:
        ans=min(ans,max(A-B+2,0)+max(C-B+1,0)+s)
    if ans==inf:
        ans=-1
    print(ans)
0