結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2023-12-13 07:48:43 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 949 ms / 2,000 ms | 
| コード長 | 1,957 bytes | 
| コンパイル時間 | 551 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-09-27 05:13:06 | 
| 合計ジャッジ時間 | 9,928 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
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")
            
            
            
        