結果

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

テストケース

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

ソースコード

diff #

T = int(input())
for _ 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')
    if x1 == x2:
        if y1 < y2:
            d1, d2 = d2, d1
        if d1=='D' and d2=='U':
            print('Yes')
        else:
            print('No')
    elif y1 == y2:
        if x1 < x2:
            d1, d2 = d2, d1
        if d1 == 'L' and d2 == 'R':
            print('Yes')
        else:
            print('No')
    else:
        if abs(x1-x2) != abs(y1-y2):
            print('No')
            continue
        if x1 > x2:
            if y1 > y2:
                if (d1 == 'L' and d2 == 'U') or (d1 == 'D' and d2 == 'R'):
                    print('Yes')
                else:
                    print('No')
            else:
                if (d1 == 'U' and d2 == 'R') or (d1 == 'L' and d2 == 'D'):
                    print('Yes')
                else:
                    print('No')
        else:
            if y1 > y2:
                if (d1 == 'R' and d2 == 'U') or (d1 == 'D' and d2 == 'L'):
                    print('Yes')
                else:
                    print('No')
            else:
                if (d1 == 'R' and d2 == 'D') or (d1 == 'U' and d2 == 'L'):
                    print('Yes')
                else:
                    print('No')
0