結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  strawberry0929 | 
| 提出日時 | 2023-12-02 16:38:15 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 305 ms / 2,000 ms | 
| コード長 | 2,513 bytes | 
| コンパイル時間 | 4,759 ms | 
| コンパイル使用メモリ | 310,480 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-26 20:32:43 | 
| 合計ジャッジ時間 | 8,605 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using mint = modint998244353;
using ll = long long;
using lb = long double;
using VI = vector<int>;
using VL = vector<ll>;
using P = pair<int, int>;
inline void scan(){}
template<class Head,class... Tail>
inline void scan(Head&head,Tail&... tail){std::cin>>head;scan(tail...);}
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define LB(...) lb __VA_ARGS__;scan(__VA_ARGS__)
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;scan(__VA_ARGS__)
template<class ll> inline bool chmax(ll& a, ll b) { if (a < b) { a = b; return 1; } return 0; }template<class ll> inline bool chmin(ll& a, ll b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T>
std::istream &operator>>(std::istream&is,std::vector<T>&v){for(T &in:v){is>>in;}return is;}
template<typename T>
std::ostream &operator<<(std::ostream&os,const std::vector<T>&v){for(auto it=std::begin(v);it!=std::end(v);){os<<*it<<((++it)!=std::end(v)?" ":"");}return os;}
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
//_
struct car
{
  int x, y;
  char d;
};
int main(){
  INT(t);
  rep(i, 0, t){
    vector<car> c(2);
    for(auto&&[x, y, d] : c){
      cin >> x >> y >> d;
    }
    bool ok = false;
    if(c[0].d == c[1].d){
      cout << "No" << endl;
      continue;
    }
    if(c[0].d > c[1].d){
      swap(c[0], c[1]);
    }
    if(c[0].d == 'D'){
      if(c[1].d == 'U'){
        if(c[0].x == c[1].x && c[0].y > c[1].y){
          ok = true;
        }
      }
      if(c[1].d == 'R'){
        if(c[0].y - c[1].y == c[0].x - c[1].x && c[0].x - c[1].x > 0){
          ok = true;
        }
      }
      if(c[1].d == 'L'){
        if(c[0].y - c[1].y == c[1].x - c[0].x && c[1].x - c[0].x > 0){
          ok = true;
        }
      }
    }
    if(c[0].d == 'L'){
      if(c[1].d == 'U'){
        if(c[0].y - c[1].y == c[0].x - c[1].x && c[0].x - c[1].x > 0){
          ok = true;
        }
      }
      if(c[1].d == 'R'){
        if(c[0].y == c[1].y && c[0].x > c[1].x){
          ok = true;
        }
      }
    }
    if(c[0].d == 'R'){
      if(c[1].d == 'U'){
        if(c[0].y - c[1].y == c[1].x - c[0].x && c[1].x - c[0].x > 0){
          ok = true;
        }
      }
    }
    if(ok){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}
            
            
            
        