結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2023-12-02 15:52:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,894 bytes |
| コンパイル時間 | 468 ms |
| コンパイル使用メモリ | 81,904 KB |
| 実行使用メモリ | 79,896 KB |
| 最終ジャッジ日時 | 2024-09-26 19:26:18 |
| 合計ジャッジ時間 | 6,364 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 9 |
ソースコード
T = int(input())
for _ in range(T):
ans = False
x1,y1,d1 = input().split()
x2,y2,d2 = input().split()
x1 = int(x1)
y1 = int(y1)
x2 = int(x2)
y2 = int(y2)
if d1=='U' and d2=='D':
if x1==x2 and y1<y2:
ans=True
if d1=='L' and d2=='R':
if y1==y2 and x1>x2:
ans = True
if d1=='U' and d2=='R':
temp1 = y2-y1
temp2 = x1-x2
if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if d1=='U' and d2=='L':
temp1 = y2-y1
temp2 = x2-x1
if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if d1=='D' and d2=='R':
temp1 = y1-y2
temp2 = x1-x2
if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if d1=='D' and d2=='L':
temp1 = y1-y2
temp2 = x2-x1
if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0:
ans=True
x1,y1,d1,x2,y2,d2 = x2,y2,d2,x1,y1,d1
if d1=='U' and d2=='D':
if x1==x2 and y1<y2:
ans=True
if d1=='L' and d2=='R':
if y1==y2 and x1>x2:
ans = True
if d1=='U' and d2=='R':
temp1 = y2-y1
temp2 = x1-x2
if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if d1=='U' and d2=='L':
temp1 = y2-y1
temp2 = x2-x1
if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if d1=='D' and d2=='R':
temp1 = y1-y2
temp2 = x1-x2
if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if d1=='D' and d2=='L':
temp1 = y1-y2
temp2 = x2-x1
if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0:
ans=True
if ans:
print('Yes')
else:
print('No')
H20