結果

問題 No.2564 衝突予測
ユーザー kemunikukemuniku
提出日時 2023-12-02 17:23:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 766 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 53,332 KB
最終ジャッジ日時 2023-12-02 17:24:03
合計ジャッジ時間 4,984 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 45 ms
53,332 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def test(x):
    dx,dy = [(1,0),(-1,0),(0,1),(0,-1)]["RLUD".index(d1)]
    ax = x1+dx*x
    ay = y1+dy*x
    dx,dy = [(1,0),(-1,0),(0,1),(0,-1)]["RLUD".index(d2)]
    bx = x2+dx*x
    by = y2+dy*x
    return (ax-bx)**2+(ay-by)**2
def solve():
    low = 0
    high = 1e18
    ans = 1e18
    while low<high:
        M1 = (low*2+high)/3
        M2 = (low+high*2)/3
        A1 = test(M1)
        A2 = test(M2)
        ans = min(A1,A2,ans)
        if A1>A2:
            low = M1+1
        else:
            high = M2-1
    return ans
T = int(input())
for i in range(T):
    x1,y1,d1 = input().split()
    x1 = int(x1)
    y1 = int(y1)
    x2,y2,d2 = input().split()
    x2 = int(x2)
    y2 = int(y2)
    if solve() < 1:
        print("Yes")
    else:
        print("No")
0