結果
問題 | No.2564 衝突予測 |
ユーザー | yansi819 |
提出日時 | 2024-03-16 17:28:49 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,229 bytes |
コンパイル時間 | 3,952 ms |
コンパイル使用メモリ | 264,252 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-30 04:07:40 |
合計ジャッジ時間 | 8,210 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,820 KB |
testcase_01 | AC | 1 ms
6,820 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 299 ms
6,820 KB |
testcase_04 | AC | 293 ms
6,820 KB |
testcase_05 | AC | 288 ms
6,816 KB |
testcase_06 | AC | 277 ms
6,816 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; int T; int main(void){ cin >> T; for (int i = 0; i < T; i++) { int x1, y1, x2, y2; char d1, d2; cin >> x1 >> y1 >> d1; cin >> x2 >> y2 >> d2; if (d1 == d2) cout << "No" << endl; else { if (d1 == 'R' and d2 == 'L') { if (y1 == y2 and x1 < x2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'L' and d2 == 'R') { if (y1 == y2 and x1 > x2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'U' and d2 == 'D') { if (x1 == x2 and y1 < y2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'D' and d2 == 'U') { if (x1 == x2 and y1 > y2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'R' and d2 == 'U') { if (x1 < x2 and y1 > y2 and y1 - y2 == x2 - x1) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'R' and d2 == 'D') { if (x1 < x2 and y1 < y2 and y2 - y1 == x2 - x1) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'L' and d2 == 'U') { if (x1 > x2 and y1 > y2 and y1 - y2 == x1 - x2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'L' and d2 == 'D') { if (x1 > x2 and y1 > y2 and y1 - y2 == x1 - x2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'U' and d2 == 'R') { if (x1 > x2 and y1 < y2 and y2 - y1 == x1 - x2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'U' and d2 == 'L') { if (x1 < x2 and y1 < y2 and y2 - y1 == x2 - x1) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'D' and d2 == 'R') { if (x1 > x2 and y1 > y2 and y1 - y2 == x1 - x2) cout << "Yes" << endl; else cout << "No" << endl; } else if (d1 == 'D' and d2 == 'L') { if (x1 < x2 and y1 > y2 and y1 - y2 == x2 - x1) cout << "Yes" << endl; else cout << "No" << endl; } } } return 0; }