結果

問題 No.2564 衝突予測
ユーザー ymsksky
提出日時 2024-04-09 23:32:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 83,256 KB
最終ジャッジ日時 2024-10-02 00:12:11
合計ジャッジ時間 5,198 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

fx = {
    "R": 1,
    "L": -1,
    "U": 0,
    "D": 0,
}
fy = {
    "R": 0,
    "L": 0,
    "U": 1,
    "D": -1,
}
ans = []
t = int(input())
for _ in range(t):
    x1, y1, d1 = input().split()
    x2, y2, d2 = input().split()
    x1, y1 = int(x1), int(y1)
    x2, y2 = int(x2), int(y2)
    t2 = abs(x2 - x1) + abs(y2 - y1)
    t = t2 / 2
    dx1, dy1 = fx[d1] * t, fy[d1] * t
    dx2, dy2 = fx[d2] * t, fy[d2] * t
    p = (x1 + dx1, y1 + dy1)
    q = (x2 + dx2, y2 + dy2)
    res = "Yes" if p == q else "No"
    ans.append(res)
for an in ans:
    print(an)
0