結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  toshiconner | 
| 提出日時 | 2023-12-02 16:39:09 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 551 ms / 2,000 ms | 
| コード長 | 784 bytes | 
| コンパイル時間 | 326 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 78,004 KB | 
| 最終ジャッジ日時 | 2024-09-26 20:33:39 | 
| 合計ジャッジ時間 | 5,979 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
T = int(input())
dir = {
    "D": (0, -1),
    "U": (0, 1),
    "L": (-1, 0),
    "R": (1, 0)
}
for _ in range(T):
    x1, y1, d1 = [x for x in input().split()]
    x2, y2, d2 = [x for x in input().split()]
    x1 = int(x1)
    y1 = int(y1)
    x2 = int(x2)
    y2 = int(y2)
    rx = x2 - x1
    ry = y2 - y1
    dx1, dy1 = dir[d1]
    dx2, dy2 = dir[d2]
    rdx = dx2 - dx1
    rdy = dy2 - dy1
    if rx < 0:
        rx = -rx
        rdx = -rdx
    if ry < 0:
        ry = -ry
        rdy = -rdy
    cond1 = rx == 0 and rdx == 0 and rdy < 0
    cond2 = ry == 0 and rdy == 0 and rdx < 0
    cond3 = (rx == ry and rdx < 0 and rdy < 0)
    ans = "Yes" if cond1 or cond2 or cond3 else "No"
    print(ans)
# x2 = 3
# y2 = 2 + t
# x3 = 5 - t
# y3 = 4
# 2 + t == 4
# 3 == 5 - t
            
            
            
        