結果

問題 No.2564 衝突予測
ユーザー i_takui_taku
提出日時 2024-06-07 14:12:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 548 ms / 2,000 ms
コード長 886 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 79,064 KB
最終ジャッジ日時 2024-06-07 14:12:54
合計ジャッジ時間 6,751 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 38 ms
52,224 KB
testcase_03 AC 545 ms
78,436 KB
testcase_04 AC 475 ms
78,120 KB
testcase_05 AC 494 ms
78,628 KB
testcase_06 AC 499 ms
78,176 KB
testcase_07 AC 530 ms
78,328 KB
testcase_08 AC 488 ms
78,308 KB
testcase_09 AC 548 ms
79,060 KB
testcase_10 AC 514 ms
78,676 KB
testcase_11 AC 547 ms
79,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
tate = ('U', 'D')
yoko = ('L', 'R')
for _ in range(T):
    x1, y1, d1 = input().split()
    x1, y1 = int(x1), int(y1)
    x2, y2, d2 = input().split()
    x2, y2 = int(x2), int(y2)
    if x1 > x2 or (x1 == x2 and y1 > y2):
        x1, y1, d1, x2, y2, d2 = x2, y2, d2, x1, y1, d1
    if d1 == 'L' or d2 == 'R':
        print('No')
        continue
    if y1 < y2 and (d1 == 'D' or d2 == 'U'):
        print('No')
        continue
    if y2 < y1 and (d1 == 'U' or d2 == 'D'):
        print('No')
        continue
    if d1 in tate and d2 in tate:
        if x1 == x2:
            print('Yes')
        else:
            print('No')
        continue
    if d1 in yoko and d2 in yoko:
        if y1 == y2:
            print('Yes')
        else:
            print('No')
        continue
    if abs(x1 - x2) == abs(y1 - y2):
        print('Yes')
    else:
        print('No')
0