結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
nzm_ort
|
| 提出日時 | 2023-12-02 16:38:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,673 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 78,892 KB |
| 最終ジャッジ日時 | 2024-09-26 20:32:25 |
| 合計ジャッジ時間 | 6,145 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 9 |
ソースコード
t = int(input())
for _ in range(t):
x1, y1, d1 = map(str, input().split())
x2, y2, d2 = map(str, input().split())
x1, y1 = int(x1), int(y1)
x2, y2 = int(x2), int(y2)
if x1==x2:
if (d1=="U" and d2=="D"):
if y1<y2: print('Yes'); continue
else: print('No'); continue
elif (d1=="D" and d2=="U"):
if y1>y2: print('Yes'); continue
else: print('No'); continue
else: print('No'); continue
elif y1==y2:
if (d1=="L" and d2=="R"):
if x1>x2: print('Yes'); continue
else: print('No'); continue
elif (d1=="R" and d2=="L"):
if x1<x2: print('Yes'); continue
else: print('No'); continue
else: print('No'); continue
else:
f = True
if d1=="U":
if y1>y2: print('No'); f=False
else: t1=y2-y1
elif d1=="D":
if y1<y2: print('No'); f=False
else: t1=y1-y2
elif d1=="L":
if x1<x2: print('No'); f=False
else: t1=x1-x2
else:
if x1>x2: print('No'); f=False
else: t1=x2-x1
if f:
if d2=="U":
if y1<y2: print('No'); f=False
else: t2=y1-y2
elif d2=="D":
if y1>y2: print('No'); f=False
else: t2=y2-y1
elif d2=="L":
if x1>x2: print('No'); f=False
else: t2=x2-x1
else:
if x1<x2: print('No'); f=False
else: t2=x1-x2
if f:
if t1==t2: print('Yes')
else: print('No')
nzm_ort