結果

問題 No.2564 衝突予測
ユーザー Pres1dent
提出日時 2023-12-02 15:47:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,418 bytes
コンパイル時間 819 ms
コンパイル使用メモリ 94,760 KB
最終ジャッジ日時 2025-02-18 04:56:45
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 4 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <string>
using namespace std;
string s = "URDL";
bool solve() {
  int x1, y1; cin >> x1 >> y1;
  char d1; cin >> d1;
  int x2, y2; cin >> x2 >> y2;
  char d2; cin >> d2;
  if (d1 == 'U' and d2 == 'R' and y2 - y1 == x1 - x2) return true;
  if (d1 == 'U' and d2 == 'D' and x1 == x2 and y1 < y2 and (y2 - y1) % 2 == 0) { return true; }
  if (d1 == 'U' and d2 == 'L' and y2 - y1 == x2 - x1) return true;
  if (d1 == 'R' and d2 == 'D' and x2 - x1 == y2 - y1) return true;
  if (d1 == 'R' and d2 == 'L' and y1 == y2 and x1 < x2 and (x2 - x1) % 2 == 0) { return true; }
  if (d1 == 'D' and d2 == 'L' and x2 - x1 == y1 - y2) return true;
  swap(d1, d2); swap(x1, x2); swap(y1, y2);
  if (d1 == 'U' and d2 == 'R' and y2 - y1 == x1 - x2) return true;
  if (d1 == 'U' and d2 == 'D' and x1 == x2 and y1 < y2 and (y2 - y1) % 2 == 0) { return true; }
  if (d1 == 'U' and d2 == 'L' and y2 - y1 == x2 - x1) return true;
  if (d1 == 'R' and d2 == 'D' and x2 - x1 == y2 - y1) return true;
  if (d1 == 'R' and d2 == 'L' and y1 == y2 and x1 < x2 and (x2 - x1) % 2 == 0) { return true; }
  if (d1 == 'D' and d2 == 'L' and x2 - x1 == y1 - y2) return true;
  return false;
}
int main() {
  int t; cin >> t;
  while (t--) {
    if (solve()) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

}

0