結果

問題 No.2564 衝突予測
ユーザー Basin-BugBasin-Bug
提出日時 2023-12-02 16:04:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,192 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,608 KB
最終ジャッジ日時 2023-12-02 16:04:24
合計ジャッジ時間 5,474 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,460 KB
testcase_01 AC 32 ms
53,456 KB
testcase_02 AC 31 ms
53,460 KB
testcase_03 AC 415 ms
76,964 KB
testcase_04 AC 409 ms
77,080 KB
testcase_05 AC 391 ms
77,128 KB
testcase_06 AC 428 ms
77,072 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):
  x1, y1, d1 = map(str, input().split())
  x1 = int(x1)
  y1 = int(y1)
  x2, y2, d2 = map(str, input().split())
  x2 = int(x2)
  y2 = int(y2)
  if d1 == d2:
    print("No")
  else:
    if (d1 == "L" and d2 == "R") or (d1 == "R" and d2 == "L"):
      if y1 == y2:
        print("Yes")
      else:
        print("No")
    elif (d1 == "U" and d2 == "D") or (d2 == "U" and d1 == "D"):
      if x1 == x2:
        print("Yes")
      else:
        print("No")
    else:
      if (d1 == "L" and d2 == "U") or (d1 == "D" and d2 == "R"):
        if y1 - y2 == x1 - x2 and y1 - y2 >= 0:
          print("Yes")
        else:
          print("No")
      elif (d1 == "L" and d2 == "D") or (d1 == "U" and d2 == "R"):
        if x1 - x2 == y2 - y1 and y2 - y1 >= 0:
          print("Yes")
        else:
          print("No")
      elif (d1 == "R" and d2 == "U") or (d1 == "D" and d2 == "L"):
        if x2 - x1 == y1 - y2 and y1 - y2 >= 0:
          print("Yes")
        else:
          print("No")
      elif (d1 == "R" and d2 == "D") or(d1 == "U" and d2 == "L"):
        if x2 - x1 == y2 - y1 and y2 - y1 >= 0:
          print("Yes")
        else:
          print("No")
0