結果

問題 No.2564 衝突予測
ユーザー ゼットゼット
提出日時 2023-12-21 00:03:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,222 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 77,984 KB
最終ジャッジ日時 2023-12-21 00:03:28
合計ジャッジ時間 7,139 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,588 KB
testcase_01 AC 38 ms
53,588 KB
testcase_02 AC 38 ms
53,588 KB
testcase_03 AC 466 ms
77,132 KB
testcase_04 AC 476 ms
77,384 KB
testcase_05 AC 466 ms
77,644 KB
testcase_06 AC 495 ms
77,360 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
for _ in range(Q):
  x1,y1,d1=input().split()
  x2,y2,d2=input().split()
  x1=int(x1)
  x2=int(x2)
  y1=int(y1)
  y2=int(y2)
  if d1==d2:
    print('No')
    continue
  if (d1=='R' and d2=='L') or (d1=='L' and d2=='R'):
    if y1!=y2:
      print('No')
      continue
    if d1=='R':
      z=1
    else:
      z=-1
    time=(x2-x1)//z
    if time>0:
      print('Yes')
    else:
      print('No')
  elif (d1=='U' and d2=='D') or (d1=='D' and d2=='U'):
    if x1!=x2:
      print('No')
      continue
    if d1=='U':
      z=1
    else:
      z=-1
    time=(y2-y1)//z
    if time>0:
      print('Yes')
    else:
      print('No')
  elif d1=='R' or d1=='L':
    x3,y3=x2,y1
    if d1=='R':
      z=1
    else:
      z=-1
    time1=(x3-x1)//z
    if d2=='U':
      z=1
    else:
      z=-1
    time2=(y2-y3)//z
    if time1!=time2:
      print('No')
    else:
      if time1>0:
        print('Yes')
      else:
        print('No')
  else:
    x3,y3=x1,y2
    if d1=='U':
      z=1
    else:
      z=-1
    time1=(y3-y1)//z
    if d2=='R':
      z=1
    else:
      z=-1
    time2=(x3-x2)//z
    if time1!=time2:
      print('No')
    else:
      if time1>0:
        print('Yes')
      else:
        print('No')
0