結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
kinoko_econ
|
| 提出日時 | 2023-12-02 16:05:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 424 ms / 2,000 ms |
| コード長 | 2,116 bytes |
| コンパイル時間 | 373 ms |
| コンパイル使用メモリ | 82,352 KB |
| 実行使用メモリ | 78,052 KB |
| 最終ジャッジ日時 | 2024-09-26 19:48:45 |
| 合計ジャッジ時間 | 5,699 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
T = int(input())
for i in range(T):
x, y, d = input().split()
x, y = int(x), int(y)
a, b, s = input().split()
a, b = int(a), int(b)
if d == 'U':
if s == 'U':
if x == a and y == b:
print('Yes')
else: print('No')
elif s == 'D':
if x == a and y <= b:
print('Yes')
else: print('No')
elif s == 'R':
if x-a == b-y and b-y >= 0:
print('Yes')
else: print('No')
else:
if a-x == b-y and b-y >= 0:
print('Yes')
else: print('No')
elif d == 'D':
if s == 'D':
if x == a and y == b:
print('Yes')
else: print('No')
elif s == 'U':
if x == a and y >= b:
print('Yes')
else: print('No')
elif s == 'R':
if x-a == y-b and y-b >= 0:
print('Yes')
else: print('No')
else:
if a-x == y-b and b-y <= 0:
print('Yes')
else: print('No')
elif d == 'R':
if s == 'R':
if x == a and y == b:
print('Yes')
else: print('No')
elif s == 'L':
if y == b and x <= a:
print('Yes')
else: print('No')
elif s == 'U':
if a-x == y-b and y-b >= 0:
print('Yes')
else: print('No')
else:
if a-x == b-y and b-y >= 0:
print('Yes')
else: print('No')
else:
if s == 'L':
if x == a and y == b:
print('Yes')
else: print('No')
elif s == 'R':
if y == b and x >= a:
print('Yes')
else: print('No')
elif s == 'U':
if x-a == y-b and y-b >= 0:
print('Yes')
else: print('No')
else:
if x-a == b-y and b-y >= 0:
print('Yes')
else: print('No')
kinoko_econ