結果

問題 No.2564 衝突予測
ユーザー ⁣
提出日時 2024-07-24 11:42:37
言語 Rust
(1.77.0)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 13,061 ms
コンパイル使用メモリ 391,728 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-24 11:42:53
合計ジャッジ時間 14,924 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,948 KB
testcase_03 AC 166 ms
6,940 KB
testcase_04 AC 166 ms
6,940 KB
testcase_05 AC 167 ms
6,944 KB
testcase_06 AC 166 ms
6,940 KB
testcase_07 AC 164 ms
6,940 KB
testcase_08 AC 165 ms
6,944 KB
testcase_09 AC 161 ms
6,940 KB
testcase_10 AC 159 ms
6,940 KB
testcase_11 AC 163 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn g() -> (i64, i64, (i64, i64)) {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	let mut w = s.split_whitespace();
	(
		w.next().unwrap().parse().unwrap(),
		w.next().unwrap().parse().unwrap(),
		match w.next().unwrap() {
			"R" => (1, 0),
			"L" => (-1, 0),
			"U" => (0, 1),
			_ => (0, -1),
		},
	)
}
fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	for _ in 0..s.trim().parse::<u64>().unwrap() {
		let (a, b, (c, d)) = g();
		let (mut x, mut y, (mut u, mut v)) = g();
		x -= a;
		y -= b;
		u -= c;
		v -= d;
		println!(
			"{}",
			if x * u < 0 && y * v < 0 && x * v == y * u
				|| x == 0 && u == 0 && y * v < 0
				|| y == 0 && v == 0 && x * u < 0
			{
				"Yes"
			} else {
				"No"
			}
		);
	}
}
0