結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-02 15:41:22 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 211 ms / 2,000 ms | 
| コード長 | 1,260 bytes | 
| コンパイル時間 | 345 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 77,312 KB | 
| 最終ジャッジ日時 | 2024-09-26 19:09:00 | 
| 合計ジャッジ時間 | 3,316 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
import sys,math
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def ms(): return map(int, input().split())
def li(): return list(map(int,input().split()))
#////////////////////////////////////
T = ii()
for _ in range(T):
  x1,y1,d1 = input().split()
  x2,y2,d2 = input().split()
  x1,x2,y1,y2 = int(x1),int(x2),int(y1),int(y2)
  dx,dy = x2-x1,y2-y1
  if dx!=0 and dy!=0 and abs(dx)!=abs(dy): 
    print('No')
    continue
  if dx<0 and dy<0:
    if (d1=='D' and d2=='R') or (d1=='L' and d2=='U'):
      print('Yes')
    else:
      print('No')
  elif dx<0 and dy>0:
    if (d1=='U' and d2=='R') or (d1=='L' and d2=='D'):
      print('Yes')
    else:
      print('No')
  elif dx>0 and dy<0:
    if (d1=='R' and d2=='U') or (d1=='D' and d2=='L'):
      print('Yes')
    else:
      print('No')
  elif dx>0 and dy>0:
    if (d1=='R' and d2=='D') or (d1=='U' and d2=='L'):
      print('Yes')
    else:
      print('No')
  elif dx==0 and dy==0: print('Yes')
  elif dx==0:
    if dy>0 and d1=='U' and d2=='D': print('Yes')
    elif dy<0 and d1=='D' and d2=='U': print('Yes')
    else: print('No')
  elif dy==0:
    if dx>0 and d1=='R' and d2=='L': print('Yes')
    elif dx<0 and d1=='L' and d2=='R': print('Yes')
    else: print('No')
            
            
            
        