結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 408 ms
77,136 KB
testcase_04 AC 416 ms
77,708 KB
testcase_05 AC 420 ms
77,372 KB
testcase_06 AC 404 ms
77,244 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):
    x, y, d = input().split()
    x, y = int(x), int(y)
    a, b, s = input().split()
    a, b = int(a), int(b)

    if d == 'U':
        if s == 'U':
            if x == a and y == b:
                print('Yes')
            else: print('No')
        elif s == 'D':
            if x == a and y <= b:
                print('Yes')
            else: print('No')
        elif s == 'R':
            if x-a == b-y and b-y >= 0:
                print('Yes')
            else: print('No')
        else:
            if x+a == b-y and b-y >= 0:
                print('Yes')
            else: print('No')
    elif d == 'D':
        if s == 'D':
            if x == a and y == b:
                print('Yes')
            else: print('No')
        elif s == 'U':
            if x == a and y >= b:
                print('Yes')
            else: print('No')
        elif s == 'R':
            if x-a == y-b and y-b >= 0:
                print('Yes')
            else: print('No')
        else:
            if a-x == y-b and b-y <= 0:
                print('Yes')
            else: print('No')
    elif d == 'R':
        if s == 'R':
            if x == a and y == b:
                print('Yes')
            else: print('No')
        elif s == 'L':
            if y == b and x <= a:
                print('Yes')
            else: print('No')
        elif s == 'U':
            if a-x == y-b and y-b >= 0:
                print('Yes')
            else: print('No')
        else:
            if a-x == b-y and b-y >= 0:
                print('Yes')
            else: print('No')
    else:
        if s == 'L':
            if x == a and y == b:
                print('Yes')
            else: print('No')
        elif s == 'R':
            if y == b and x >= a:
                print('Yes')
            else: print('No')
        elif s == 'U':
            if x-a == y-b and y-b >= 0:
                print('Yes')
            else: print('No')
        else:
            if x-a == b-y and b-y >= 0:
                print('Yes')
            else: print('No')


        

        
        



        
0