結果
| 問題 | No.2564 衝突予測 |
| コンテスト | |
| ユーザー |
mymelochan
|
| 提出日時 | 2023-12-02 15:46:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 395 ms / 2,000 ms |
| コード長 | 2,046 bytes |
| 記録 | |
| コンパイル時間 | 341 ms |
| コンパイル使用メモリ | 82,360 KB |
| 実行使用メモリ | 78,332 KB |
| 最終ジャッジ日時 | 2024-09-26 19:15:31 |
| 合計ジャッジ時間 | 5,059 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
#############################################################
import sys
sys.setrecursionlimit(10**7)
from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations
from math import sin,cos
#from math import isqrt #DO NOT USE PyPy
ipt = sys.stdin.readline
iin = lambda :int(ipt())
lmin = lambda :list(map(int,ipt().split()))
#############################################################
direc = {"U":0,"D":2,"R":1,"L":3}
for _ in range(iin()):
i1 = input().split()
i2 = input().split()
x1,y1,d1 = int(i1[0]),int(i1[1]),direc[i1[2]]
x2,y2,d2 = int(i2[0]),int(i2[1]),direc[i2[2]]
if d1 == d2:
print("No")
continue
if d1%2 == 0 and d2%2 == 0:
if x1 == x2:
if d1 == 0:
if y1 < y2:
print("Yes")
else:
print("No")
else:
if y1 > y2:
print("Yes")
else:
print("No")
else:
print("No")
elif d1%2 == 1 and d2%2 == 1:
if y1 == y2:
if d1 == 1:
if x1 < x2:
print("Yes")
else:
print("No")
else:
if x1 > x2:
print("Yes")
else:
print("No")
else:
print("No")
else:
dx = x1-x2
dy = y1-y2
if dx == dy:
if x1 < x2:
d1,d2 = d2,d1
if (d1 == 2 and d2 == 1) or (d1 == 3 and d2 == 0):
print("Yes")
else:
print("No")
elif dx == -dy:
if x1 < x2:
d1,d2 = d2,d1
if (d1 == 0 and d2 == 1) or (d1 == 3 and d2 == 2):
print("Yes")
else:
print("No")
else:
print("No")
mymelochan