結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
Yuto_kyopro0731
|
| 提出日時 | 2023-12-02 16:27:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,457 bytes |
| コンパイル時間 | 189 ms |
| コンパイル使用メモリ | 81,932 KB |
| 実行使用メモリ | 81,240 KB |
| 最終ジャッジ日時 | 2024-09-26 20:19:46 |
| 合計ジャッジ時間 | 7,624 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 5 |
ソースコード
#R=0,U=1,L=2,D=3,
d = [(1,0), (0,1), (-1,0), (0,-1)]
def change(case):
res = [0,0,0]
res[0] = int(case[0])
res[1] = int(case[1])
if case[2]=='R':res[2] = 0
elif case[2]=='U':res[2] = 1
elif case[2]=='L':res[2] = 2
elif case[2]=='D':res[2] = 3
return res
def check(case1, case2):
x1,y1,d1 = case1
x2,y2,d2 = case2
if d1!=d2 and (d1+d2)%2==0:
if d1*d2==0 and y1==y2:return True
elif d1*d2>0 and x1==x2:return True
else:return False
elif d1==d2:return False
#1が左右に動く
if d1%2==0:
dx21 = x2- x1
#離れていく場合
if dx21 >0 and d1==2:return False
elif dx21 < 0 and d1==0:return False
dy21 = y2-y1
if dy21 > 0 and d2==3:return False
elif dy21 < 0 and d2 == 1:return False
if abs(dy21) == abs(dx21):return True
#1が上下に動く
else:
#上下に動く
dy21 = y2-y1
#離れる場合
if dy21 > 0 and d1==3:return False
elif dy21 < 0 and d1 == 1:return False
dx21 = x2- x1
#離れる場合
if dx21 >0 and d1==2:return False
elif dx21 < 0 and d1==0:return False
if abs(dx21) == abs(dy21):return True
T = int(input())
for i in range(T):
case1 = change(list(input().split()))
case2 = change(list(input().split()))
ans = check(case1, case2)
print('Yes' if ans else 'No')
Yuto_kyopro0731