結果
問題 | No.2564 衝突予測 |
ユーザー | loop0919 |
提出日時 | 2023-11-14 19:37:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 451 ms / 2,000 ms |
コード長 | 1,102 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 77,348 KB |
最終ジャッジ日時 | 2023-11-23 14:02:48 |
合計ジャッジ時間 | 5,552 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 33 ms
53,460 KB |
testcase_02 | AC | 36 ms
53,460 KB |
testcase_03 | AC | 438 ms
76,740 KB |
testcase_04 | AC | 441 ms
77,004 KB |
testcase_05 | AC | 431 ms
76,740 KB |
testcase_06 | AC | 444 ms
76,996 KB |
testcase_07 | AC | 431 ms
76,740 KB |
testcase_08 | AC | 433 ms
77,004 KB |
testcase_09 | AC | 451 ms
77,348 KB |
testcase_10 | AC | 451 ms
77,224 KB |
testcase_11 | AC | 450 ms
77,220 KB |
ソースコード
rotate = ["R", "U", "L", "D"] def solve(): x_1, y_1, d_1 = input().split() x_1 = int(x_1); y_1 = int(y_1) d_1 = rotate.index(d_1) x_2, y_2, d_2 = input().split() x_2 = int(x_2); y_2 = int(y_2) d_2 = rotate.index(d_2) # d_1 が R になるように回転させる while d_1 != 0: x_1, y_1 = -y_1, x_1 x_2, y_2 = -y_2, x_2 d_1 += 1; d_1 %= 4 d_2 += 1; d_2 %= 4 # 衝突しないパターン if x_1 > x_2: print("No") return # d_2 ごとに場合分けする match rotate[d_2]: case "R": print("No") case "U": if x_2 - x_1 == y_1 - y_2: print("Yes") else: print("No") case "L": if y_1 == y_2: print("Yes") else: print("No") case "D": if x_2 - x_1 == y_2 - y_1: print("Yes") else: print("No") T = int(input()) for _ in range(T): solve()