結果

問題 No.2564 衝突予測
ユーザー hatonobuhatonobu
提出日時 2023-12-02 15:24:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,402 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 82,776 KB
最終ジャッジ日時 2023-12-02 15:25:06
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,732 KB
testcase_01 AC 41 ms
55,732 KB
testcase_02 AC 42 ms
55,732 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 #

import sys
from collections import deque,defaultdict
import itertools
import heapq
import bisect
import math

#sys.setrecursionlimit(10 ** 9)
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
ml = lambda: map(str, input().split())
li = lambda: list(mi())
li_st = lambda: list(map(str, input().split()))
lli = lambda n: [li() for _ in range(n)]
mod = 998244353

T = ii()
def check(x,y,d,xx,yy):
    if d == "U":
        if yy >= y:
            y += yy - y
        else:
            return x,y,False
    elif d == "D":
        if y >= yy:
            y -= y - yy
        else:
            return x,y,False
    elif d == "L":
        if x >= xx:
            x -= x - xx
        else:
            return x,y,False
    else:
        if xx >= x:
            x += xx - x
        else:
            return x,y,False
        
    return x,y,True


for i in range(T):
    x1,y1,d1 = ml()
    x2,y2,d2 = ml()
    x1,y1 = int(x1),int(y1)
    x2,y2 = int(x2),int(y2)
    ans = set()
    cc = {(x1,y1),(x2,y2)}
    x,y,flag1 = check(x1,y1,d1,x2,y2)
    xx,yy,flag2 = check(x2,y2,d2,x1,y1)
    if flag1 and flag2:
        ans.add((x,y))
        ans.add((xx,yy))
        if len(ans) == 1:
            print("Yes")
        else:
            if ans == cc:
                print("Yes")
            else:
                print("No")
    else:
        print("No")
0