結果

問題 No.2564 衝突予測
コンテスト
ユーザー hiro1729
提出日時 2023-12-02 14:56:45
言語 PyPy3
(7.3.23 + ac-library)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 292 ms / 2,000 ms
+ 265µs
コード長 657 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 229 ms
コンパイル使用メモリ 96,208 KB
実行使用メモリ 86,456 KB
最終ジャッジ日時 2026-09-05 00:52:04
合計ジャッジ時間 6,310 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

for _ in range(int(input())):
	x1, y1, d1 = input().split()
	x1, y1 = map(int, (x1, y1))
	x2, y2, d2 = input().split()
	x2, y2 = map(int, (x2, y2))
	d = d1 + d2
	x2 -= x1
	y2 -= y1
	ok = False
	if x2 == 0:
		if y2 > 0 and d == "UD":
			ok = True
		if y2 < 0 and d == "DU":
			ok = True
	if y2 == 0:
		if x2 > 0 and d == "RL":
			ok = True
		if x2 < 0 and d == "LR":
			ok = True
	if x2 == y2:
		if x2 > 0 and (d == "UL" or d == "RD"):
			ok = True
		if x2 < 0 and (d == "DR" or d == "LU"):
			ok = True
	if x2 == -y2:
		if x2 > 0 and (d == "DL" or d == "RU"):
			ok = True
		if x2 < 0 and (d == "UR" or d == "LD"):
			ok = True
	print("Yes" if ok else "No")
0