結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
gabriel55_
|
| 提出日時 | 2023-12-02 15:20:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,618 bytes |
| コンパイル時間 | 1,920 ms |
| コンパイル使用メモリ | 193,728 KB |
| 最終ジャッジ日時 | 2025-02-18 04:28:23 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 9 |
ソースコード
#if !__INCLUDE_LEVEL__
#include __FILE__
void solve() {
ll x1, y1, x2, y2;
char d1, d2;
cin >> x1 >> y1 >> d1 >> x2 >> y2 >> d2;
if(y1 == y2) {
if(x1 > x2) {
swap(x1, x2);
swap(d1, d2);
}
if(d1 == 'R' && d2 == 'L') cout << "Yes\n";
else cout << "No\n";
return;
}
if(x1 == x2) {
if(y1 < y2) {
swap(y1, y2);
swap(d1, d2);
}
if(d1 == 'D' && d2 == 'U') cout << "Yes\n";
else cout << "No\n";
return;
}
if(y1 < y2) {
swap(x1, x2);
swap(y1, y2);
swap(d1, d2);
}
if(d1 == 'D') {
if(x1 < x2 && d2 != 'L') {
cout << "No\n";
return;
}
if(x2 < x1 && d2 != 'R') {
cout << "No\n";
return;
}
cout << "Yes\n";
return;
}
if(d1 == 'R' && d2 == 'U' && x1 < x2 && abs(x1 - x2) == abs(y1 - y2)) {
cout << "Yes\n";
return;
}
if(d1 == 'L' && d2 == 'U' && x2 < x1 && abs(x1 - x2) == abs(y1 - y2)) {
cout << "Yes\n";
return;
}
cout << "No\n";
}
int main() {
ll t;
cin >> t;
while(t--) solve();
}
/*---------------------------------------------------------------------------------------------------
○______
|| |
|| ● |
|| |
|| ̄ ̄ ̄ ̄ ̄
|| 君が代は
∧__,,∧|| 千代に八千代に
( `・ω・|| さざれ石の巌となりて
ヽ つ0 こけのむすまで
し―-J
---------------------------------------------------------------------------------------------------*/
#else
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using ldb = long double;
using P = pair<ll, ll>;
#define fi first
#define se second
#define m_99(i,a,b) for (ll i = a, i##_range = (b); i < i##_range; i++)
#define REP(i,a,b) m_99(i,a,b)
#define rep(i,a) m_99(i,0,a)
template <class T> bool chmin(T& a, const T& b) { return a > b ? a = b, true : false; }
template <class T> bool chmax(T& a, const T& b) { return a < b ? a = b, true : false; }
#ifdef _DEBUG
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
struct initialise { initialise() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; }__INI__;
const ll inf = 1LL << 60;
const ll dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1};
#endif
gabriel55_