結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  H20 | 
| 提出日時 | 2023-12-02 15:57:25 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 583 ms / 2,000 ms | 
| コード長 | 2,032 bytes | 
| コンパイル時間 | 305 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 79,772 KB | 
| 最終ジャッジ日時 | 2024-09-26 19:34:32 | 
| 合計ジャッジ時間 | 6,878 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
T = int(input())
for _ in range(T):
    ans = False
    x1,y1,d1 = input().split()
    x2,y2,d2 = input().split()
    x1 = int(x1)
    y1 = int(y1)
    x2 = int(x2)
    y2 = int(y2)
    if d1=='U' and d2=='D':
        if x1==x2 and y1<y2:
            ans=True
    if d1=='L' and d2=='R':
        if y1==y2 and x1>x2:
            ans = True
    if d1=='U' and d2=='R':
        temp1 = y2-y1
        temp2 = x1-x2
        if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if d1=='U' and d2=='L':
        temp1 = y2-y1
        temp2 = x2-x1
        if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if d1=='D' and d2=='R':
        temp1 = y1-y2
        temp2 = x1-x2
        if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if d1=='D' and d2=='L':
        temp1 = y1-y2
        temp2 = x2-x1
        if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    x1,y1,d1,x2,y2,d2 = x2,y2,d2,x1,y1,d1
    if d1=='U' and d2=='D':
        if x1==x2 and y1<y2:
            ans=True
    if d1=='L' and d2=='R':
        if y1==y2 and x1>x2:
            ans = True
    if d1=='U' and d2=='R':
        temp1 = y2-y1
        temp2 = x1-x2
        if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if d1=='U' and d2=='L':
        temp1 = y2-y1
        temp2 = x2-x1
        if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if d1=='D' and d2=='R':
        temp1 = y1-y2
        temp2 = x1-x2
        if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if d1=='D' and d2=='L':
        temp1 = y1-y2
        temp2 = x2-x1
        if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2:
            ans=True
    if ans:
        print('Yes')
    else:
        print('No')
            
            
            
        