結果

問題 No.2564 衝突予測
ユーザー titiatitia
提出日時 2023-12-13 07:48:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 917 ms / 2,000 ms
コード長 1,957 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2023-12-13 07:48:54
合計ジャッジ時間 10,572 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,240 KB
testcase_01 AC 29 ms
10,240 KB
testcase_02 AC 29 ms
10,240 KB
testcase_03 AC 890 ms
10,368 KB
testcase_04 AC 892 ms
10,368 KB
testcase_05 AC 917 ms
10,368 KB
testcase_06 AC 908 ms
10,368 KB
testcase_07 AC 911 ms
10,368 KB
testcase_08 AC 914 ms
10,368 KB
testcase_09 AC 914 ms
10,368 KB
testcase_10 AC 904 ms
10,368 KB
testcase_11 AC 911 ms
10,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for tests in range(T):
    x1,y1,d1=input().split()
    x2,y2,d2=input().split()

    x1=int(x1)
    x2=int(x2)
    y1=int(y1)
    y2=int(y2)

    if d1==d2:
        print("No")
        continue

    if d1=="U" and d2=="D":
        if x1==x2 and y1<=y2:
            print("Yes")
        else:
            print("No")
    elif d1=="D" and d2=="U":
        if x1==x2 and y1>=y2:
            print("Yes")
        else:
            print("No")
    elif d1=="R" and d2=="L":
        if x1<=x2 and y1==y2:
            print("Yes")
        else:
            print("No")
    elif d1=="L" and d2=="R":
        if x1>=x2 and y1==y2:
            print("Yes")
        else:
            print("No")

    elif d1=="U" and d2=="R":
        if y1<=y2 and x1>=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")
            
    elif d1=="U" and d2=="L":
        if y1<=y2 and x1<=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")

    elif d1=="D" and d2=="R":
        if y1>=y2 and x1>=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")
            
    elif d1=="D" and d2=="L":
        if y1>=y2 and x1<=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")

    elif d1=="R" and d2=="U":
        if y1>=y2 and x1<=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")
            
    elif d1=="R" and d2=="D":
        if y1<=y2 and x1<=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")

    elif d1=="L" and d2=="U":
        if y1>=y2 and x1>=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")
            
    elif d1=="L" and d2=="D":
        if y1<=y2 and x1>=x2 and abs(x1-x2)==abs(y1-y2):
            print("Yes")
        else:
            print("No")
0