結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
あ
|
| 提出日時 | 2023-12-14 00:14:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 453 ms / 2,000 ms |
| コード長 | 1,308 bytes |
| コンパイル時間 | 367 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 77,328 KB |
| 最終ジャッジ日時 | 2024-09-27 05:35:56 |
| 合計ジャッジ時間 | 5,398 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
t = int(input())
for _ in range(t):
x1, y1, d1 = input().split()
x2, y2, d2 = input().split()
x1 = int(x1)
x2 = int(x2)
y1 = int(y1)
y2 = int(y2)
if x1 == x2:
if y1 > y2 and d1 == 'D' and d2 == 'U':
print('Yes')
continue
if y2 > y1 and d1 == 'U' and d2 == 'D':
print('Yes')
continue
print('No')
continue
if y1 == y2:
if x1 > x2 and d1 == 'L' and d2 == 'R':
print('Yes')
continue
if x2 > x1 and d1 == 'R' and d2 == 'L':
print('Yes')
continue
print('No')
continue
if abs(x1 - x2) != abs(y1 - y2):
print('No')
continue
if x1 < x2 and y1 < y2:
if (d1 == 'U' and d2 == 'L') or (d1 == 'R' and d2 == 'D'):
print('Yes')
continue
if x1 < x2 and y1 > y2:
if (d1 == 'D' and d2 == 'L') or (d1 == 'R' and d2 == 'U'):
print('Yes')
continue
if x1 > x2 and y1 < y2:
if (d1 == 'U' and d2 == 'R') or (d1 == 'L' and d2 == 'D'):
print('Yes')
continue
if x1 > x2 and y1 > y2:
if (d1 == 'L' and d2 == 'U') or (d1 == 'D' and d2 == 'R'):
print('Yes')
continue
print('No')
あ