結果

問題 No.2564 衝突予測
ユーザー nzm_ortnzm_ort
提出日時 2023-12-02 15:52:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,480 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 78,300 KB
最終ジャッジ日時 2023-12-02 15:52:47
合計ジャッジ時間 6,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    x1, y1, d1 = map(str, input().split())
    x2, y2, d2 = map(str, input().split())
    x1, y1 = int(x1), int(y1)
    x2, y2 = int(x2), int(y2)
    
    if x1==x2:
        if (d1=="U" and d2=="D"):
            if y1<y2: print('Yes')
            else: print('No')
        elif (d1=="D" and d2=="U"):
            if y1>y2: print('Yes')
            else: print('No')
        else: print('No')
    elif y1==y2:
        if (d1=="L" and d2=="R"):
            if x1>x2: print('Yes')
            else: print('No')
        elif (d1=="R" and d2=="L"):
            if x1<x2: print('Yes')
            else: print('No')
        else: print('No')
    else:
        if d1=="U":
            if y1>y2: print('No'); continue
            else: t1=y2-y1
        elif d1=="D":
            if y1<y2: print('No'); continue
            else: t1=y1-y2
        elif d1=="L":
            if x1<x2: print('No'); continue
            else: t1=x1-x2
        else:
            if x1>x2: print('No'); continue
            else: t1=x2-x1
        
        if d2=="U":
            if y1<y2: print('No'); continue
            else: t2=y1-y2
        elif d2=="D":
            if y1>y2: print('No'); continue
            else: t2=y2-y1
        elif d2=="L":
            if x1>x2: print('No'); continue
            else: t2=x2-x1
        else:
            if x1<x2: print('No'); continue
            else: t2=x1-x2
        
        if t1==t2: print('Yes')
        else: print('No')
0