結果

問題 No.2564 衝突予測
ユーザー 👑 binapbinap
提出日時 2023-12-02 15:29:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,134 bytes
コンパイル時間 4,339 ms
コンパイル使用メモリ 262,212 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-26 18:45:45
合計ジャッジ時間 8,321 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 316 ms
5,376 KB
testcase_04 AC 323 ms
5,376 KB
testcase_05 AC 322 ms
5,376 KB
testcase_06 AC 330 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:58:20: warning: 'z1' may be used uninitialized [-Wmaybe-uninitialized]
   58 |         if(z1 == 2 or z1 == 3){
      |            ~~~~~~~~^~~~~~~~~~
main.cpp:29:13: note: 'z1' was declared here
   29 |         int z1, z2;
      |             ^~

ソースコード

diff #

#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) cout << "Yes\n";
		else cout << "No\n";
		return;
	}
	if(z1 + z2 == 5){
		if(z2 == 2){
			swap(p1, p2);
			swap(z1, z2);
		}
		if(p1.first == p2.first) cout << "Yes\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;
}
0