結果

問題 No.2564 衝突予測
ユーザー mealymealy
提出日時 2023-12-02 16:52:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 476 ms / 2,000 ms
コード長 2,324 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 78,028 KB
最終ジャッジ日時 2023-12-02 16:52:46
合計ジャッジ時間 6,035 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,460 KB
testcase_01 AC 32 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 470 ms
77,516 KB
testcase_04 AC 441 ms
77,624 KB
testcase_05 AC 465 ms
77,744 KB
testcase_06 AC 439 ms
77,936 KB
testcase_07 AC 437 ms
77,908 KB
testcase_08 AC 431 ms
77,932 KB
testcase_09 AC 476 ms
77,908 KB
testcase_10 AC 450 ms
78,028 KB
testcase_11 AC 465 ms
78,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Input_kyopro:
    def II(self): return int(input())
    def MI(self): return map(int,input().split())
    def MS(self): return map(str,input().split())
    def LMI(self): return list(self.MI())
    def LMS(self): return list(self.MS())
    def LLI(self,N): return [self.LMI() for _ in range(N)]
    def LLS(self,N): return [self.LMS() for _ in range(N)]
    def LS(self,N): return [input() for _ in range(N)]
    def LSL(self,N): return [list(input()) for _ in range(N)]
    def LI(self,N): return [self.II() for _ in range(N)]
I=Input_kyopro()
#入力
T=I.II()
for _ in range(T):
    x0,y0,d0=I.MS()
    x1,y1,d1=I.MS()
    x0=int(x0)
    y0=int(y0)
    x1=int(x1)
    y1=int(y1)
    if d0==d1:
        print('No')
    elif d0=='U':
        if d1=='D' and x0==x1 and y0<y1:
            print('Yes')
        elif d1=='L':
            if x1-x0>0 and x1-x0==y1-y0:
                print('Yes')
            else:
                print('No')
        elif d1=='R':
            if x0-x1>0 and x0-x1==y1-y0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    elif d0=='D':
        if d1=='U' and x0==x1 and y0>y1:
            print('Yes')
        elif d1=='L':
            if x1-x0>0 and x1-x0==y0-y1:
                print('Yes')
            else:
                print('No')
        elif d1=='R':
            if x0-x1>0 and x0-x1==y0-y1:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    elif d0=='R':
        if d1=='L' and y0==y1 and x0<x1:
            print('Yes')
        elif d1=='D':
            if y1-y0>0 and y1-y0==x1-x0:
                print('Yes')
            else:
                print('No')
        elif d1=='U':
            if y0-y1>0 and y0-y1==x1-x0:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    elif d0=='L':
        if d1=='R' and y0==y1 and x0>x1:
            print('Yes')
        elif d1=='D':
            if y1-y0>0 and y1-y0==x0-x1:
                print('Yes')
            else:
                print('No')
        elif d1=='U':
            if y0-y1>0 and y0-y1==x0-x1:
                print('Yes')
            else:
                print('No')
        else:
            print('No')
    
    
0