結果
問題 | No.8063 幅優先探索 |
ユーザー | akakimidori |
提出日時 | 2020-04-01 22:17:23 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 1,476 bytes |
コンパイル時間 | 13,439 ms |
コンパイル使用メモリ | 390,548 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 11:17:48 |
合計ジャッジ時間 | 14,189 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
コンパイルメッセージ
warning: unused variable: `w` --> src/main.rs:51:9 | 51 | w: usize, | ^ | help: `w` is captured in macro and introduced a unused variable --> src/main.rs:23:13 | 23 | let $var = read_value!($iter, $t); | ^^^^ ... 49 | / input! { 50 | | h: usize, 51 | | w: usize, 52 | | s: (i64, i64), 53 | | t: (i64, i64), 54 | | board: [chars; h], 55 | | } | |_____- 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: `board` --> src/main.rs:54:9 | 54 | board: [chars; h], | ^^^^^ | help: `board` is captured in macro and introduced a unused variable --> src/main.rs:23:13 | 23 | let $var = read_value!($iter, $t); | ^^^^ ... 49 | / input! { 50 | | h: usize, 51 | | w: usize, 52 | | s: (i64, i64), 53 | | t: (i64, i64), 54 | | board: [chars; h], 55 | | } | |_____- 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)
ソースコード
//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, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } // fn run() { input! { h: usize, w: usize, s: (i64, i64), t: (i64, i64), board: [chars; h], } let ans = (s.0 - t.0).abs() + (s.1 - t.1).abs(); println!("{}", ans); } fn main() { run(); }