結果
問題 | No.2564 衝突予測 |
ユーザー |
![]() |
提出日時 | 2023-12-02 15:49:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 343 ms / 2,000 ms |
コード長 | 1,895 bytes |
コンパイル時間 | 1,936 ms |
コンパイル使用メモリ | 194,136 KB |
最終ジャッジ日時 | 2025-02-18 04:58:33 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) using ll = long long; int ctoi(char c){return c-'0';} ll ctoll(char c){return c-'0';} int main(){ int t; cin >> t; rep(i,t){ int x1,y1; int x2,y2; char d1,d2; cin >> x1 >> y1 >> d1; cin >> x2 >> y2 >> d2; if(x1 > x2){ swap(x1,x2); swap(y1,y2); swap(d1,d2); } if(y1 == y2){ if(d1=='R' && d2=='L'){ cout << "Yes" << endl; }else{ cout << "No" << endl; } continue; } if(x1 == x2){ if(y1>y2){ if(d1=='D' && d2=='U'){ cout << "Yes" << endl; }else{ cout << "No" << endl; } }else{ if(d1=='U' && d2=='D'){ cout << "Yes" << endl; }else{ cout << "No" << endl; } } continue; } int tate = abs(y1-y2); int yoko = abs(x1-x2); if(tate==yoko){ if(y1>y2){ if((d1=='R' && d2=='U') || (d1=='D' && d2=='L')){ cout << "Yes" << endl; }else{ cout << "No" << endl; } }else{ if((d1=='R' && d2=='D') || (d1=='U' && d2=='L')){ cout << "Yes" << endl; }else{ cout << "No" << endl; } } continue; }else{ cout << "No" << endl; } } }