結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,460 KB
testcase_01 AC 31 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 410 ms
77,140 KB
testcase_04 AC 426 ms
77,704 KB
testcase_05 AC 416 ms
77,372 KB
testcase_06 AC 406 ms
77,240 KB
testcase_07 AC 445 ms
77,376 KB
testcase_08 AC 413 ms
77,376 KB
testcase_09 AC 407 ms
77,504 KB
testcase_10 AC 433 ms
77,500 KB
testcase_11 AC 416 ms
77,504 KB
権限があれば一括ダウンロードができます

ソースコード

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 a-x == 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