結果

問題 No.2564 衝突予測
ユーザー ゼットゼット
提出日時 2023-12-21 01:45:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 551 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 79,408 KB
最終ジャッジ日時 2023-12-21 01:45:54
合計ジャッジ時間 6,421 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 523 ms
78,144 KB
testcase_04 AC 491 ms
78,144 KB
testcase_05 AC 510 ms
78,144 KB
testcase_06 AC 491 ms
78,412 KB
testcase_07 AC 508 ms
78,136 KB
testcase_08 AC 495 ms
78,136 KB
testcase_09 AC 521 ms
79,408 KB
testcase_10 AC 551 ms
79,404 KB
testcase_11 AC 524 ms
79,408 KB
権限があれば一括ダウンロードができます

ソースコード

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)
  L=[[1,0],[-1,0],[0,1],[0,-1]]
  s='RLUD'
  T={}
  for i in range(4):
    T[s[i]]=i
  v=[0]*2
  k=L[T[d2]][:]
  for j in range(2):
    v[j]+=k[j]
  k=L[T[d1]][:]
  for j in range(2):
    v[j]-=k[j]
  if v[0]==0 and v[1]==0:
    print('No')
    continue
  if v[0]==0:
    if x1!=x2:
      print('No')
      continue
    time=(y1-y2)/(v[1])
    if time>0:
      print('Yes')
    else:
      print('No')
  elif v[1]==0:
    if y1!=y2:
      print('No')
      continue
    time=(x1-x2)/(v[0])
    if time>0:
      print('Yes')
    else:
      print('No')
  else:
    time1=(x1-x2)//(v[0])
    time2=(y1-y2)//(v[1])
    if time1!=time2:
      print('No')
    else:
      if time1>0:
        print('Yes')
      else:
        print('No')
0