結果

問題 No.1714 Tag on Grid
ユーザー akakimidoriakakimidori
提出日時 2021-10-22 21:24:25
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 1,830 bytes
コンパイル時間 12,482 ms
コンパイル使用メモリ 376,996 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-23 04:35:00
合計ジャッジ時間 13,633 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused import: `std::io::Write`
  --> src/main.rs:51:5
   |
51 | use std::io::Write;
   |     ^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `h`
  --> src/main.rs:60:9
   |
60 |         h: u32,
   |         ^
   |
help: `h` is captured in macro and introduced a unused variable
  --> src/main.rs:24:13
   |
24 |           let $var = read_value!($iter, $t);
   |               ^^^^
...
59 | /     input! {
60 | |         h: u32,
61 | |         w: u32,
62 | |         a: (u32, u32),
63 | |         b: (u32, u32),
64 | |     }
   | |_____- in this macro invocation
   = note: `#[warn(unused_variables)]` on by default
   = note: this warning originates in the macro `input_inner` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused variable: `w`
  --> src/main.rs:61:9
   |
61 |         w: u32,
   |         ^
   |
help: `w` is captured in macro and introduced a unused variable
  --> src/main.rs:24:13
   |
24 |           let $var = read_value!($iter, $t);
   |               ^^^^
...
59 | /     input! {
60 | |         h: u32,
61 | |         w: u32,
62 | |         a: (u32, u32),
63 | |         b: (u32, u32),
64 | |     }
   | |_____- in this macro invocation
   = note: this warning originates in the macro `input_inner` which comes from the expansion of the macro `input` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: type alias `Map` is never used
  --> src/main.rs:54:6
   |
54 | type Map<K, V> = BTreeMap<K, V>;
   |      ^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: type alias `Set` is never used
  --> src/main.rs:55:6
   |
55 | type Set<T> = BTreeSet<T>;
   |      ^^^

warning: type alias `Deque` is never used
  --> src/main.rs:56:6
   |
56 | type Deque<T> = VecDeque<T>;
   |      ^^^^^

ソースコード

diff #

// ---------- begin input macro ----------
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, bytes) => {
        read_value!($iter, String).bytes().collect::<Vec<u8>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// ---------- end input macro ----------

use std::io::Write;
use std::collections::*;

type Map<K, V> = BTreeMap<K, V>;
type Set<T> = BTreeSet<T>;
type Deque<T> = VecDeque<T>;

fn run() {
    input! {
        h: u32,
        w: u32,
        a: (u32, u32),
        b: (u32, u32),
    }
    let p = (a.0 + a.1) & 1;
    let q = (b.0 + b.1) & 1;
    if p == q {
        println!("No");
    } else {
        println!("Yes");
    }
}

fn main() {
    run();
}
0