結果

問題 No.2564 衝突予測
ユーザー yansi819
提出日時 2024-03-16 17:28:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,229 bytes
コンパイル時間 4,407 ms
コンパイル使用メモリ 252,352 KB
最終ジャッジ日時 2025-02-20 06:55:49
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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