結果
問題 | No.2564 衝突予測 |
ユーザー | 👑 H20 |
提出日時 | 2023-12-02 15:57:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 542 ms / 2,000 ms |
コード長 | 2,032 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 79,368 KB |
最終ジャッジ日時 | 2023-12-02 15:57:32 |
合計ジャッジ時間 | 6,194 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
53,460 KB |
testcase_01 | AC | 35 ms
53,460 KB |
testcase_02 | AC | 37 ms
53,460 KB |
testcase_03 | AC | 539 ms
78,940 KB |
testcase_04 | AC | 509 ms
79,056 KB |
testcase_05 | AC | 508 ms
78,944 KB |
testcase_06 | AC | 540 ms
79,084 KB |
testcase_07 | AC | 514 ms
79,368 KB |
testcase_08 | AC | 519 ms
78,620 KB |
testcase_09 | AC | 532 ms
79,328 KB |
testcase_10 | AC | 521 ms
79,328 KB |
testcase_11 | AC | 542 ms
79,328 KB |
ソースコード
T = int(input()) for _ in range(T): ans = False x1,y1,d1 = input().split() x2,y2,d2 = input().split() x1 = int(x1) y1 = int(y1) x2 = int(x2) y2 = int(y2) if d1=='U' and d2=='D': if x1==x2 and y1<y2: ans=True if d1=='L' and d2=='R': if y1==y2 and x1>x2: ans = True if d1=='U' and d2=='R': temp1 = y2-y1 temp2 = x1-x2 if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='U' and d2=='L': temp1 = y2-y1 temp2 = x2-x1 if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='R': temp1 = y1-y2 temp2 = x1-x2 if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='L': temp1 = y1-y2 temp2 = x2-x1 if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True x1,y1,d1,x2,y2,d2 = x2,y2,d2,x1,y1,d1 if d1=='U' and d2=='D': if x1==x2 and y1<y2: ans=True if d1=='L' and d2=='R': if y1==y2 and x1>x2: ans = True if d1=='U' and d2=='R': temp1 = y2-y1 temp2 = x1-x2 if y1+temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='U' and d2=='L': temp1 = y2-y1 temp2 = x2-x1 if y1+temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='R': temp1 = y1-y2 temp2 = x1-x2 if y1-temp1==y2 and x2+temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if d1=='D' and d2=='L': temp1 = y1-y2 temp2 = x2-x1 if y1-temp1==y2 and x2-temp2==x1 and temp1>=0 and temp2>=0 and temp1==temp2: ans=True if ans: print('Yes') else: print('No')