結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 16:58:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,645 bytes |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 128,840 KB |
| 最終ジャッジ日時 | 2024-09-26 20:55:40 |
| 合計ジャッジ時間 | 4,188 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 5 |
ソースコード
t = int(input())
l = []
v = {"R":"L","L":"R","U":"D","D":"U"}
for _ in range(t):
tmp = []
for i in range(2):
x,y,d = input().split()
tmp.append((int(x),int(y),d))
l.append(tmp)
ans = []
for i in l:
now1x = i[0][0]
now1y = i[0][1]
now2x = i[1][0]
now2y = i[1][1]
now1d = i[0][2]
now2d = i[1][2]
if v[i[0][2]] == i[1][2]: # ぶつかる方向
if now1x == now2x:
if now2y < now1y:
now1y,now2y = now2y,now1y
now1d,now2d = now2d,now1d
if now1y <= now2y and now1d == "U":
ans.append("Yes")
else:
ans.append("No")
continue
elif now1y == now2y:
if now2x < now1x:
now1x,now2x = now2x,now1x
now1d,now2d = now2d,now1d
if now1x <= now2x and now1d == "R":
ans.append("Yes")
else:
ans.append("No")
continue
else:
ans.append("No")
else: # ぶつかる方向でないなら
dist1 = abs(now1x-now2x)
dist2 = abs(now1y-now2y)
if v[i[0][2]] != i[1][2] and dist1 == dist2:
if now1d == "R" and now1x <= now2x:
ans.append("Yes")
elif now1d == "L" and now2x <= now1x:
ans.append("Yes")
elif now1d == "U" and now1y <= now2y:
ans.append("Yes")
elif now1d == "D" and now2y <= now1y:
ans.append("Yes")
else:
ans.append("No")
else:
ans.append("No")
print(*ans,sep="\n")