結果
| 問題 |
No.1714 Tag on Grid
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-05 20:52:14 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,261 bytes |
| コンパイル時間 | 14,661 ms |
| コンパイル使用メモリ | 378,248 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 13:40:41 |
| 合計ジャッジ時間 | 15,387 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#[macro_export]
macro_rules! setup {
{ mut $input:ident: SplitWhitespace $(,)? } => {
use std::io::Read;
let mut buf = String::new();
std::io::stdin().read_to_string(&mut buf).ok();
let mut $input = buf.split_whitespace();
};
}
#[macro_export]
macro_rules! parse_next {
($str_iter:expr) => {
$str_iter.next().unwrap().parse().ok().unwrap()
};
}
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
fn main() {
setup! { mut input: SplitWhitespace };
let _h: usize = parse_next!(input);
let _w: usize = parse_next!(input);
let n: (usize, usize) = (parse_next!(input), parse_next!(input));
let z: (usize, usize) = (parse_next!(input), parse_next!(input));
macro_rules! manhattan_distance {
($x:expr, $y:expr) => {{
let x_1 = $x.0 as i64;
let x_2 = $x.1 as i64;
let y_1 = $y.0 as i64;
let y_2 = $y.1 as i64;
(x_1 - y_1).abs() + (x_2 - y_2).abs()
}};
}
let ans = match (|| {
if manhattan_distance!(n, z) % 2 != 0 {
return true;
}
return false;
})() {
true => "Yes",
false => "No",
};
println!("{}", ans);
}