結果

問題 No.2213 Neq Move
ユーザー ShirotsumeShirotsume
提出日時 2022-10-12 23:07:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 75,356 KB
最終ジャッジ日時 2023-09-21 21:56:48
合計ジャッジ時間 1,439 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

def solve():
    a, b, c, d = mi()
    
    ta = False
    tb = False
    if a > c:
        ta = True
        a = 0
    if b > d:
        tb = True
        b = 0
    #a <= c && b <= d
    if a > b:
        a, b = b, a
        c, d = d, c
        ta, tb = tb, ta
    if c > d:
        tb = True
    ans = 0
    if ta:
        ans += 1 + c
    else:
        ans += c - a
    if tb:
        ans += 1 + d
    else:
        ans += d - b
    if ta and tb:
        if c == 1:
            ans += 1
        if d == 1:
            ans += 1
    print(ans)
    
for _ in range(ii()):
    solve()
0