結果

問題 No.2213 Neq Move
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-02-10 23:08:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 76,464 KB
最終ジャッジ日時 2023-09-22 00:14:22
合計ジャッジ時間 1,646 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,440 KB
testcase_01 AC 104 ms
76,464 KB
testcase_02 AC 105 ms
76,224 KB
testcase_03 AC 103 ms
76,432 KB
testcase_04 AC 112 ms
76,332 KB
testcase_05 AC 105 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    a,b,c,d = map(int,input().split())

    if a < b:
        a,b = b,a
        c,d = d,c

    if c > d:
        if c >= a and d >= b:
            return c+d-a-b
        if c >= a and d <= b:
            return d+1+c-a
        
        if b > 1:
            return 3+c-1+d
        else:
            return 4+c-1+d
    else:
        if d >= b:
            return 1+c+d-b
        else:
            return 3+d-1+c


t = int(input())
for _ in range(t):
    print(solve())
0