結果

問題 No.2564 衝突予測
ユーザー 👑 timitimi
提出日時 2023-12-02 15:07:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 467 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 78,448 KB
最終ジャッジ日時 2023-12-02 15:08:04
合計ジャッジ時間 5,814 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 454 ms
77,960 KB
testcase_04 AC 427 ms
78,448 KB
testcase_05 AC 435 ms
77,864 KB
testcase_06 AC 465 ms
78,036 KB
testcase_07 AC 443 ms
77,524 KB
testcase_08 AC 439 ms
77,800 KB
testcase_09 AC 467 ms
77,948 KB
testcase_10 AC 435 ms
77,936 KB
testcase_11 AC 434 ms
77,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for _ in range(T):
  x,y,d1=input().split()
  xx,yy,d2=input().split()
  x,y,xx,yy=int(x),int(y),int(xx),int(yy)
  if d2=='R' or d2=='L':
    x,y,d1,xx,yy,d2=xx,yy,d2,x,y,d1
  f=0
  if d1=='R' and d2=='L':
    if y==yy and x<xx:
      f=1
  elif d2=='R' and d1=='L':
    if y==yy and xx<x:
      f=1
  elif d1=='U' and d2=='D':
    if x==xx and y<yy:
      f=1
  elif d2=='U' and d1=='D':
    if x==xx and yy<y:
      f=1
  else:
    if d1=='R':
      if d2=='D':
        if xx-x==yy-y and xx-x>0:
          f=1 
      if d2=='U':
        if xx-x==y-yy and xx-x>0:
          f=1  
    if d1=='L':
      if d2=='D':
        if x-xx==yy-y and x-xx>0:
          f=1 
      if d2=='U':
        if x-xx==y-yy and x-xx>0:
          f=1  
  if f==0:
    print('No')
  else:
    print('Yes')
0