結果

問題 No.2564 衝突予測
ユーザー AngrySadEightAngrySadEight
提出日時 2023-11-24 01:08:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 474 ms / 2,000 ms
コード長 1,624 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,564 KB
最終ジャッジ日時 2023-11-24 01:08:52
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 442 ms
77,532 KB
testcase_04 AC 468 ms
77,496 KB
testcase_05 AC 443 ms
77,084 KB
testcase_06 AC 469 ms
77,564 KB
testcase_07 AC 445 ms
76,948 KB
testcase_08 AC 445 ms
77,084 KB
testcase_09 AC 474 ms
77,236 KB
testcase_10 AC 454 ms
77,236 KB
testcase_11 AC 473 ms
77,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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