結果

問題 No.2564 衝突予測
ユーザー kemunikukemuniku
提出日時 2023-12-02 15:17:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,235 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,844 KB
最終ジャッジ日時 2023-12-02 15:18:02
合計ジャッジ時間 5,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 467 ms
77,340 KB
testcase_04 AC 457 ms
77,628 KB
testcase_05 AC 486 ms
77,524 KB
testcase_06 AC 462 ms
77,216 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for i in range(T):
    x1,y1,d1 = input().split()
    x2,y2,d2 = input().split()
    x1 = int(x1)
    y1 = int(y1)
    x2 = int(x2)
    y2 = int(y2)
    if d1 == d2:
        print("No")
    elif d1 in "RL"  and d2 in "RL":
        if y1 == y2:
            print("Yes")
        else:
            print("No")
    elif d1 in "UD" and d2 in "UD":
        if x1 == x2:
            print("Yes")
        else:
            print("No")
    else:
        x2-=x1
        y2-=y1
        x1,y1 = 0,0
        if d1 == "R":
            pass
        if d1 == "L":
            x2 *= -1
        if d1 == "U":
            x2,y2 = y2,x2
            y2 *= -1
            if d2 == "R":
                d2 = "D"
            else:
                d2 = "U"
        if d1 == "D":
            x2,y2 = y2,x2
            x2 *= -1
            if d2 == "L":
                d2 = "D"
            else:
                d2 = "U"
        if (y2 > 0 and d2 == "U") or (y2 < 0 and d2 == "D"):
            print("No")
        elif y2 >= 0:
            if y2 == x2:
                print("Yes")
            else:
                print("No")
        else:
            if (-y2) == x2:
                print("Yes")
            else:
                print("No")
0