結果

問題 No.2564 衝突予測
ユーザー hiro1729hiro1729
提出日時 2023-12-02 14:56:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 399 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,856 KB
最終ジャッジ日時 2023-12-02 14:56:53
合計ジャッジ時間 5,355 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 395 ms
76,728 KB
testcase_04 AC 369 ms
76,728 KB
testcase_05 AC 371 ms
76,728 KB
testcase_06 AC 371 ms
76,728 KB
testcase_07 AC 372 ms
76,728 KB
testcase_08 AC 371 ms
76,728 KB
testcase_09 AC 394 ms
76,856 KB
testcase_10 AC 399 ms
76,856 KB
testcase_11 AC 394 ms
76,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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