結果
問題 | No.2564 衝突予測 |
ユーザー |
![]() |
提出日時 | 2023-12-02 15:38:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 195 ms / 2,000 ms |
コード長 | 4,669 bytes |
コンパイル時間 | 4,272 ms |
コンパイル使用メモリ | 234,144 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-26 19:04:41 |
合計ジャッジ時間 | 6,452 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
/*∧∧∩( ゚∀゚)/ キタ━━━━━━(゚∀゚)━━━━━━!!!!⊂ ノ ゆっくり見てってね!!!!!!!!(つ ノo (ノ\ ☆| o(⌒ ⌒ヽ / ☆\ (´⌒ ⌒ ⌒ヾ /('⌒ ; ⌒ ::⌒ )(´ ) ::: ) /☆─ (´⌒;: ::⌒`) :; )*/#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;#define elif else if#define rep(i, s, n) for (int i=s; i<n; i++)#define all(a) a.begin(), a.end()// xを2進数にした際にi桁目が0か1か#define bit(x,i)((x>>i)&1)typedef long long ll;typedef long double ld;ld pi = 3.14159265358979;inline void scan(){}template<class Head,class... Tail>inline void scan(Head&head,Tail&... tail){std::cin>>head;scan(tail...);}// print(a, b, c) => cout << a << ' ' << b << ' ' << c << endl;inline void print(){}template<class Head,class... Tail>inline void print(Head&head,Tail&... tail){std::cout<<head<<" ";print(tail...);cout<<endl;}// bool型に対して"Yes", "No" を出力するbool printb(bool f) {if (f) cout << "Yes\n";else cout << "No\n";return f;}//vectorのcout,cintemplate<typename T>std::istream &operator>>(std::istream&is,std::vector<T>&v){for(T &in:v){is>>in;}return is;}template<typename T>std::ostream &operator<<(std::ostream&os,const std::vector<T>&v){for(auto it=std::begin(v);it!=std::end(v);){os<<*it<<((++it)!=std::end(v)?" ":"");}return os;}// 2地点の距離(long double)long double coor_dist(long double xi, long double yi, long double xj, long double yj) {return sqrt(abs((xi - xj) * (xi - xj)) + abs((yi - yj) * (yi - yj)));}// 回文かどうかの判定bool iskaibun(string s){ll k = s.size();rep(i,0,k/2){if(s[i]!=s[k-1-i]){return false;}}return true;}template<class T> void chmax(T& a, T b) { if (a < b) a = b; }template<class T> void chmin(T& a, T b) { if (a > b) a = b; }#define mod 998244353using mint = modint998244353;int op(int a, int b) {return max(a, b);}int e() {return 0;}int mapping(int f, int x) {return (f == 1e9 ? x : f);}int composition(int f, int g) {return (f == 1e9 ? g : f);}int id() {return 1e9;}signed main() {cin.tie(nullptr);cout << fixed << setprecision(10);ios::sync_with_stdio(false);int t; cin >> t;auto f = [&](auto&& f, int i) -> void {if(!i) cout << "No" << endl;else cout << "Yes" << endl;return ;};auto g = [&](auto&& g, vector<int> x, vector<int> y, vector<char> d) -> void {int a, b;if(d[0] == 'R' || d[0] == 'L') a = 1;if(d[1] == 'R' || d[1] == 'L') b = 1;if(d[0] == 'U' || d[0] == 'D') a = 2;if(d[1] == 'U' || d[1] == 'D') b = 2;if(a == b && a == 1) {bool ans = true;if(x[0] < x[1]) {if(!(d[0] == 'R' && d[1] == 'L')) ans = false;} else {if(!(d[0] == 'L' && d[1] == 'R')) ans = false;}if(y[0] != y[1]) f(f, 0);elif(!ans) f(f, 0);else f(f, 1);} elif(a == b && a == 2) {bool ans = true;if(y[0] < y[1]) {if(!(d[0] == 'U' && d[1] == 'D')) ans = false;} else {if(!(d[0] == 'D' && d[1] == 'U')) ans = false;}if(x[0] != x[1]) f(f, 0);elif(!ans) f(f, 0);else f(f, 1);} elif(a == 1) {int gx = x[1];int gy = y[0];int sax = gx-x[0];int say = gy-y[1];if(d[0] == 'L') sax *= -1;if(d[1] == 'D') say *= -1;if(sax < 0 || say < 0 || sax != say) f(f, 0);else f(f, 1);} else {int gx = x[0];int gy = y[1];int sax = gx-x[1];int say = gy-y[0];if(d[1] == 'L') sax *= -1;if(d[0] == 'D') say *= -1;if(sax < 0 || say < 0 || sax != say) f(f, 0);else f(f, 1);}};while(t--) {vector<int> x(2), y(2);vector<char> d(2);cin >> x[0] >> y[0] >> d[0];cin >> x[1] >> y[1] >> d[1];g(g, x, y, d);}}