結果

問題 No.2564 衝突予測
ユーザー yansi819yansi819
提出日時 2024-03-16 17:28:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,229 bytes
コンパイル時間 4,539 ms
コンパイル使用メモリ 263,404 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-16 17:28:59
合計ジャッジ時間 9,456 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 328 ms
6,676 KB
testcase_04 AC 352 ms
6,676 KB
testcase_05 AC 327 ms
6,676 KB
testcase_06 AC 325 ms
6,676 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0