結果
| 問題 |
No.2564 衝突予測
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 17:18:53 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,122 bytes |
| コンパイル時間 | 13,850 ms |
| コンパイル使用メモリ | 378,932 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 21:09:51 |
| 合計ジャッジ時間 | 13,773 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | RE * 9 |
ソースコード
fn solve() -> bool {
let xyd = input();
let mut xyd = xyd.split(' ');
let x1: u64 = xyd.next().unwrap().parse().unwrap();
let y1: u64 = xyd.next().unwrap().parse().unwrap();
let d1: &str = xyd.next().unwrap();
let xyd = input();
let mut xyd = xyd.split(' ');
let x2: u64 = xyd.next().unwrap().parse().unwrap();
let y2: u64 = xyd.next().unwrap().parse().unwrap();
let d2: &str = xyd.next().unwrap();
match (d1, d2) {
(dt1, dt2) if dt1 == dt2 => false,
("L", "R") => y1 == y2 && x1 > x2,
("R", "L") => y1 == y2 && x1 < x2,
("U", "D") => x1 == x2 && x1 < x2,
("D", "U") => x1 == x2 && x1 > x2,
_ => {
let dx = if x1 < x2 {
x2 - x1
}else {
x1 - x2
};
let dy = if y1 < y2 {
y2 - y1
}else {
y1 - y2
};
dx == dy
},
}
}
fn main() {
let t: usize = input().parse().unwrap();
for _ in 0..t {
println!("{}", if solve() { "Yes" } else { "No" });
}
}
fn input() -> String {
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).unwrap();
return buffer.trim().to_string();
}