結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 14:56:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 401 ms / 2,000 ms |
| コード長 | 657 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 77,696 KB |
| 最終ジャッジ日時 | 2024-09-26 17:43:49 |
| 合計ジャッジ時間 | 4,958 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
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")