結果
問題 | No.2564 衝突予測 |
ユーザー | toshiconner |
提出日時 | 2023-12-02 16:39:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 562 ms / 2,000 ms |
コード長 | 784 bytes |
コンパイル時間 | 243 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 77,928 KB |
最終ジャッジ日時 | 2023-12-02 16:39:15 |
合計ジャッジ時間 | 6,445 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
53,332 KB |
testcase_01 | AC | 36 ms
53,332 KB |
testcase_02 | AC | 36 ms
53,332 KB |
testcase_03 | AC | 458 ms
76,868 KB |
testcase_04 | AC | 455 ms
76,868 KB |
testcase_05 | AC | 452 ms
76,868 KB |
testcase_06 | AC | 485 ms
76,868 KB |
testcase_07 | AC | 456 ms
76,868 KB |
testcase_08 | AC | 463 ms
76,740 KB |
testcase_09 | AC | 562 ms
77,928 KB |
testcase_10 | AC | 534 ms
77,908 KB |
testcase_11 | AC | 561 ms
77,924 KB |
ソースコード
T = int(input()) dir = { "D": (0, -1), "U": (0, 1), "L": (-1, 0), "R": (1, 0) } for _ in range(T): x1, y1, d1 = [x for x in input().split()] x2, y2, d2 = [x for x in input().split()] x1 = int(x1) y1 = int(y1) x2 = int(x2) y2 = int(y2) rx = x2 - x1 ry = y2 - y1 dx1, dy1 = dir[d1] dx2, dy2 = dir[d2] rdx = dx2 - dx1 rdy = dy2 - dy1 if rx < 0: rx = -rx rdx = -rdx if ry < 0: ry = -ry rdy = -rdy cond1 = rx == 0 and rdx == 0 and rdy < 0 cond2 = ry == 0 and rdy == 0 and rdx < 0 cond3 = (rx == ry and rdx < 0 and rdy < 0) ans = "Yes" if cond1 or cond2 or cond3 else "No" print(ans) # x2 = 3 # y2 = 2 + t # x3 = 5 - t # y3 = 4 # 2 + t == 4 # 3 == 5 - t