結果
問題 | No.2564 衝突予測 |
ユーザー | 👑 binap |
提出日時 | 2023-12-02 15:34:09 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 301 ms / 2,000 ms |
コード長 | 2,242 bytes |
コンパイル時間 | 4,028 ms |
コンパイル使用メモリ | 262,616 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 18:54:54 |
合計ジャッジ時間 | 7,553 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
コンパイルメッセージ
main.cpp: In function 'void solve()': main.cpp:41:17: warning: 'z2' may be used uninitialized [-Wmaybe-uninitialized] 41 | if(z2 == 0){ | ^~ main.cpp:29:17: note: 'z2' was declared here 29 | int z1, z2; | ^~ main.cpp:62:20: warning: 'z1' may be used uninitialized [-Wmaybe-uninitialized] 62 | if(z1 == 2 or z1 == 3){ | ~~~~~~~~^~~~~~~~~~ main.cpp:29:13: note: 'z1' was declared here 29 | int z1, z2; | ^~
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; using namespace atcoder; typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; typedef vector<vector<int>> vvi; typedef vector<vector<long long>> vvl; typedef long double ld; typedef pair<int, int> P; ostream& operator<<(ostream& os, const modint& a) {os << a.val(); return os;} template <int m> ostream& operator<<(ostream& os, const static_modint<m>& a) {os << a.val(); return os;} template<typename T> istream& operator>>(istream& is, vector<T>& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template<typename U, typename T> ostream& operator<<(ostream& os, const pair<U, T>& p){os << p.first << ' ' << p.second; return os;} template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template <typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} string t = "RLUD"; void solve(){ pair<long long, long long> p1, p2; long long x1, y1, x2, y2; char c1, c2; cin >> p1.first >> p1.second >> c1; cin >> p2.first >> p2.second >> c2; int z1, z2; rep(i, 4){ if(c1 == t[i]) z1 = i; } rep(i, 4){ if(c2 == t[i]) z2 = i; } if(z1 == z2){ cout << "No\n"; return; } if(z1 + z2 == 1){ if(z2 == 0){ swap(p1, p2); swap(z1, z2); } if(p1.second == p2.second){ if(p1.first < p2.first) cout << "Yes\n"; else cout << "No\n"; }else cout << "No\n"; return; } if(z1 + z2 == 5){ if(z2 == 2){ swap(p1, p2); swap(z1, z2); } if(p1.first == p2.first){ if(p1.second < p2.second) cout << "Yes\n"; else cout << "No\n"; }else cout << "No\n"; return; } if(z1 == 2 or z1 == 3){ swap(p1, p2); swap(z1, z2); } if(z1 == 1){ p1.first *= -1; p2.first *= -1; z1 = 0; } if(z2 == 3){ p1.second *= -1; p2.second *= -1; z2 = 2; } if(p1.first + p1.second == p2.first + p2.second){ if(p1.first < p2.first) cout << "Yes\n"; else cout << "No\n"; }else cout << "No\n"; return; } int main(){ int t; cin >> t; rep(_, t) solve(); return 0; }