結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-02 15:21:19 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 350 ms / 2,000 ms | 
| コード長 | 3,645 bytes | 
| コンパイル時間 | 2,490 ms | 
| コンパイル使用メモリ | 210,224 KB | 
| 最終ジャッジ日時 | 2025-02-18 04:29:04 | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
template <typename T> using min_priority_queue = priority_queue<T,vector<T>,greater<T>>;
template<typename T>
void printv(vector<T> &v){
    bool b = false;
    for(auto i : v){
        if(b) cout << " ";
        else b = true;
        cout << i;
    }
    cout << endl;
}
template <typename T>
bool chmin(T &a, const T& b) {
    if (a > b) {
        a = b;  // aをbで更新
        return true;
    }
    return false;
}
template <typename T>
bool chmax(T &a, const T& b) {
    if (a < b) {
        a = b;  // aをbで更新
        return true;
    }
    return false;
}
void yn(bool b){
    if(b) cout << "Yes" << endl;
    else cout << "No" << endl;
}
bool debug;
bool randomInput;
void input(){
    if(debug && randomInput){
        
    }
    else{
        
    }
    return;
}
void calc(){
    vector<vector<int>> dir = {{1,0},{0,1},{-1,0},{0,-1}};
    map<char,int> mp;
    mp['D'] = 0;
    mp['R'] = 1;
    mp['U'] = 2;
    mp['L'] = 3;
    int T; cin >> T;
    for(int i = 0; i < T; i++){
        int x1, y1;
        int x2, y2;
        char d1, d2;
        cin >> x1 >> y1 >> d1;
        cin >> x2 >> y2 >> d2;
        swap(x1, y1);
        swap(x2, y2);
        x1 *= -1;
        x2 *= -1;
        int a1 = mp[d1];
        int a2 = mp[d2];
        if(d1 == d2){
            cout << "No" << endl;
            continue;
        }
        if(a1 > a2){
            swap(x1, x2);
            swap(y1, y2);
            swap(a1, a2);
        }
        if(a1%2 == 1 && a2%2 == 1){
            if(x1 != x2){
                cout << "No" << endl;
            }
            else if(y1 < y2) {
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            continue;
        }
        if(a1%2 == 0 && a2%2 == 0){
            if(y1 != y2){
                cout << "No" << endl;
            }
            else if(x1 < x2){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            continue;
        }
        if(a1 == 0 && a2 == 1){
            int l1 = x2-x1;
            int l2 = y1-y2;
            if(l1 == l2 && l1 > 0){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            continue;
        }
        if(a1 == 0 && a2 == 3){
            int l1 = x2-x1;
            int l2 = y2-y1;
            if(l1 == l2 && l1 > 0){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            continue;
        }
        if(a1 == 1 && a2 == 2){
            int l1 = y2-y1;
            int l2 = x2-x1;
            if(l1 == l2 && l1 > 0){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            continue;
        }
        if(a1 == 2 && a2 == 3){
            int l1 = x1-x2;
            int l2 = y2-y1;
            if(l1 == l2 && l1 > 0){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            continue;
        }
    }
    return;
}
int64_t ansSimple;
void calcSimple(){
    return;
}
void calc1(){
    int t; cin >> t;
    for(int i = 0; i < t; i++){
        input();
        calc();
        calcSimple();
    }
}
int main(){
    debug = 0;
    randomInput = 0;
    srand(time(NULL));
    cout << fixed << setprecision(12);
    if(debug){
        calc1();
    }
    else{
        input();
        calc();
    }
    return 0;
}
//
            
            
            
        