結果

問題 No.2564 衝突予測
ユーザー LucagonLucagon
提出日時 2023-12-02 15:43:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 394 ms / 2,000 ms
コード長 1,009 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,240 KB
最終ジャッジ日時 2023-12-02 15:43:57
合計ジャッジ時間 4,886 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 381 ms
77,112 KB
testcase_04 AC 360 ms
77,112 KB
testcase_05 AC 388 ms
77,112 KB
testcase_06 AC 349 ms
77,112 KB
testcase_07 AC 390 ms
77,240 KB
testcase_08 AC 355 ms
77,112 KB
testcase_09 AC 394 ms
77,240 KB
testcase_10 AC 390 ms
77,240 KB
testcase_11 AC 385 ms
77,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())

for i in range(t):
    a = list(input().split())
    b = list(input().split())
    x1,y1,d1 = int(a[0]),int(a[1]),a[2]
    x2,y2,d2 = int(b[0]),int(b[1]),b[2]
    flag = False

    if x1 == x2:
        if ((y1 > y2 and d1 == "D" and d2 == "U") or
            (y1 < y2 and d1 == "U" and d2 == "D")):
            flag = True
    if y1 == y2:
        if ((x1 > x2 and d1 == "L" and d2 == "R") or
            (x1 < x2 and d1 == "R" and d2 == "L")):
            flag = True
    if abs(x1 - x2) == abs(y1 - y2):
        if x2 < x1:
            if (y1 > y2 and ((d1 == "L" and d2 == "U") or (d1 == "D" and d2 == "R")) or
                y1 < y2 and ((d1 == "L" and d2 == "D") or (d1 == "U" and d2 == "R"))):
                flag = True
        if x1 < x2:
            if (y1 > y2 and ((d1 == "R" and d2 == "U") or (d1 == "D" and d2 == "L")) or
                y1 < y2 and ((d1 == "R" and d2 == "D") or (d1 == "U" and d2 == "L"))):
                flag = True
    
    print("Yes" if flag else "No")
0