結果
| 問題 | No.2564 衝突予測 | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2023-12-06 00:42:40 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 345 ms / 2,000 ms | 
| コード長 | 1,131 bytes | 
| コンパイル時間 | 4,256 ms | 
| コンパイル使用メモリ | 249,960 KB | 
| 最終ジャッジ日時 | 2025-02-18 08:03:33 | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
int main(){
	
	int _t;
	cin>>_t;
	rep(_,_t){
		int a,b,d,e;
		char c,f;
		cin>>a>>b>>c>>d>>e>>f;
		b *= -1;
		e *= -1;
		if(c>f){
			swap(a,d);
			swap(b,e);
			swap(c,f);
		}
		if(c==f){
			cout<<"No"<<endl;
			continue;
		}
		if(c=='D'){
			if(f=='R'){
				f = 'L';
				d -= 2*(d-a);
			}
			if(f=='L'){
				if(e-b==d-a && d-a>=0){
					cout<<"Yes"<<endl;
				}
				else cout<<"No"<<endl;
			}
			else if(f=='U'){
				if(a==d&&b<=e){
					cout<<"Yes"<<endl;
				}
				else cout<<"No"<<endl;
			}
		}
		else if(c=='L'){
			if(f=='R'){
				if(a>=d&&b==e){
					cout<<"Yes"<<endl;
				}
				else cout<<"No"<<endl;
			}
			else if(f=='U'){
				if(a-d==e-b && e-b>=0){
					cout<<"Yes"<<endl;
				}
				else cout<<"No"<<endl;
			}
		}
		else if(c=='R'){
			if(f=='U'){
				if(d-a==e-b && e-b>=0){
					cout<<"Yes"<<endl;
				}
				else cout<<"No"<<endl;
			}
		}
		
	}
	
	return 0;
}
            
            
            
        