結果

問題 No.2564 衝突予測
ユーザー tkykwtnbtkykwtnb
提出日時 2024-03-30 18:17:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 998 ms / 2,000 ms
コード長 926 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,112 KB
最終ジャッジ日時 2024-03-30 18:17:32
合計ジャッジ時間 11,160 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,112 KB
testcase_01 AC 30 ms
10,112 KB
testcase_02 AC 29 ms
10,112 KB
testcase_03 AC 998 ms
10,112 KB
testcase_04 AC 966 ms
10,112 KB
testcase_05 AC 990 ms
10,112 KB
testcase_06 AC 991 ms
10,112 KB
testcase_07 AC 965 ms
10,112 KB
testcase_08 AC 995 ms
10,112 KB
testcase_09 AC 965 ms
10,112 KB
testcase_10 AC 986 ms
10,112 KB
testcase_11 AC 986 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
    x2-=x1;y2-=y1
    x1-=x1;y1-=y1
    if x2<0:
        x2*=-1
        if d1=="R":d1="L"
        elif d1=="L":d1="R"
        if d2=="R":d2="L"
        elif d2=="L":d2="R"
    if y2<0:
        y2*=-1
        if d1=="U":d1="D"
        elif d1=="D":d1="U"
        if d2=="U":d2="D"
        elif d2=="D":d2="U"
    if d1==d2 or d1=="L" or d1=="D":print("No")
    elif d1=="U":
        if d2=="D":
            if x1==x2:print("Yes")
            else:print("No")
        elif d2=="L":
            if x2==y2:print("Yes")
            else:print("No")
        else:print("No")
    elif d1=="R":
        if d2=="L":
            if y1==y2:print("Yes")
            else:print("No")
        elif d2=="D":
            if x2==y2:print("Yes")
            else:print("No")
        else:print("No")
0