結果
問題 | No.2564 衝突予測 |
ユーザー |
![]() |
提出日時 | 2023-12-02 15:48:18 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,932 bytes |
コンパイル時間 | 4,417 ms |
コンパイル使用メモリ | 263,028 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 19:19:25 |
合計ジャッジ時間 | 8,581 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 333 ms
5,248 KB |
testcase_04 | AC | 336 ms
5,376 KB |
testcase_05 | AC | 338 ms
5,376 KB |
testcase_06 | AC | 333 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
ソースコード
#include <bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using ll = long long; // -2^63 ~ 2^63-1 (9.2*10^18) using ull = unsigned long long; // 0 ~ 2^64-1 (1.8*10^19) using ld = long double; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, m, n) for (int i = (m); (i) < int (n); i++) #define all(v) v.begin(), v.end() #define bit(n) (1ll<<(n)) // 2^n #define sz(x) ((int)(x).size()) #define fi first #define se second template<class T> using maxpq = priority_queue<T>; template<class T> using minpq = priority_queue<T, vector<T>, greater<T>>; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const ll llINF = 1000000000000000000; void YesNo(bool flag){ if(flag) cout << "Yes" << endl; else cout << "No" << endl; } // 多次元vector生成 template<ll idx = 0, ll n, class T> auto make_vec(const ll (&d)[n], T&& init) noexcept { if constexpr (idx < n) return std::vector(d[idx], make_vec<idx + 1>(d, std::forward<T>(init))); else return init; } template<class T, ll idx = 0, ll n> auto make_vec(const ll (&d)[n], const T& init = {}) noexcept { if constexpr (idx < n) return std::vector(d[idx], make_vec<idx + 1>(d, init)); else return init; } // auto 変数名 = make_vec<型>({a, b, ...}, 初期値); int main(){ int T; cin >> T; while(T--){ vector<int> x(2), y(2); vector<char> d(2); rep(i, 2){ cin >> x[i] >> y[i] >> d[i]; } if(d[0] == d[1]){ cout << "No" << endl; continue; } if(d[0] == 'R'){ if(d[1] == 'L'){ YesNo(y[0] == y[1] && x[0] < x[1]); } if(d[1] == 'U'){ YesNo(x[1]-x[0] == y[0]-y[1]); } if(d[1] == 'D'){ YesNo(x[1]-x[0] == y[1]-y[0]); } } if(d[0] == 'L'){ if(d[1] == 'R'){ YesNo(y[0] == y[1] && x[1] < x[0]); } if(d[1] == 'U'){ YesNo(x[0]-x[1] == y[0]-y[1]); } if(d[1] == 'D'){ YesNo(x[0]-x[1] == y[1]-y[0]); } } if(d[0] == 'U'){ if(d[1] == 'R'){ YesNo(x[0]-x[1] == y[1]-y[0]); } if(d[1] == 'L'){ YesNo(x[1]-x[0] == y[1]-y[0]); } if(d[1] == 'D'){ YesNo(x[0] == x[1] && y[0] < y[1]); } } if(d[0] == 'D'){ if(d[1] == 'R'){ YesNo(x[0]-x[1] == y[0]-y[1]); } if(d[1] == 'L'){ YesNo(x[1]-x[0] == y[0]-y[1]); } if(d[1] == 'U'){ YesNo(x[0] == x[1] && y[1] < y[0]); } } } }