結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
MM
|
| 提出日時 | 2023-12-02 15:22:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,216 bytes |
| コンパイル時間 | 3,594 ms |
| コンパイル使用メモリ | 230,768 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 18:33:23 |
| 合計ジャッジ時間 | 7,337 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 5 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
#define chmin(x,y) (x) = min((x),(y))
#define chmax(x,y) (x) = max((x),(y))
#define ld long double
using namespace std;
using namespace atcoder;
using ll = long long;
const ll mod = 998244353;
using mint = modint998244353;
using Graph = vector<vector<int>>;
const vector<int> dx = {1,0,-1,0}, dy = {0,1,0,-1};
int main(){
int T; cin >> T;
while(T--){
// input
int x1,x2,y1,y2; char d1,d2;
cin >> x1 >> y1 >> d1;
cin >> x2 >> y2 >> d2;
// prep
if(d1 > d2){
swap(x1,x2);
swap(y1,y2);
swap(d1,d2);
}
// solve
bool crash = 0;
if(d1 == 'L' && d2 == 'R' && y1 == y2 && x1 > x2) crash = 1;
else if(d1 == 'D' && d2 == 'U' && x1 == x2 && y1 > y2) crash = 1;
else{
int X,Y,t1,t2;
if(d1 == 'D'){
X = x1, Y = y2;
t1 = y1-Y, t2 = (X-x2) * (d2 == 'R' ? 1 : -1) ;
} else { // then d2 == 'U' and d1 == 'L'/'R'
X = x2, Y = y1;
t1 = (X-x1) * (d1 == 'R' ? 1 : -1), t2 = Y-y2;
}
if(t1 == t2 && t1 > 0) crash = 1;
//cout << X << " " << Y << " " << t1 << " " << t2 << endl;
}
// output
cout << (crash ? "Yes" : "No") << endl;
}
}
MM