結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-12-03 23:55:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,152 bytes |
| コンパイル時間 | 435 ms |
| コンパイル使用メモリ | 41,088 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 22:24:23 |
| 合計ジャッジ時間 | 1,902 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 5 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2564.cc: No.2564 衝突予測 - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
/* global variables */
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int x0, y0, x1, y1;
char s0[4], s1[4];
scanf("%d%d%s%d%d%s", &x0, &y0, s0, &x1, &y1, s1);
char c0 = s0[0], c1 = s1[0];
if ((y0 == y1 &&
((x0 < x1 && c0 == 'R' && c1 == 'L') ||
(x0 > x1 && c0 == 'L' && c1 == 'R'))) ||
(x0 == x1 &&
((y0 < y1 && c0 == 'U' && c1 == 'D') ||
(y0 > y1 && c0 == 'D' && c1 == 'U'))))
puts("Yes");
else if ((c0 == 'L' || c0 == 'R') && (c1 == 'U' || c1 == 'D')) {
int d0 = (c0 == 'L') ? x0 - x1 : x1 - x0;
int d1 = (c1 == 'U') ? y0 - y1 : y1 - y0;
if (d0 == d1) puts("Yes");
else puts("No");
}
else if ((c0 == 'U' || c0 == 'D') && (c1 == 'L' || c1 == 'R')) {
int d0 = (c0 == 'D') ? y0 - y1 : y1 - y0;
int d1 = (c1 == 'R') ? x0 - x1 : x1 - x0;
if (d0 == d1) puts("Yes");
else puts("No");
}
else
puts("No");
}
return 0;
}
tnakao0123