結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2019-04-30 13:15:42 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 927 bytes |
コンパイル時間 | 26,738 ms |
コンパイル使用メモリ | 377,788 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 18:57:33 |
合計ジャッジ時間 | 28,375 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
warning: function `read` is never used --> src/main.rs:1:4 | 1 | fn read<T: std::str::FromStr>() -> T | ^^^^ | = note: `#[warn(dead_code)]` on by default
ソースコード
fn read<T: std::str::FromStr>() -> T where <T as std::str::FromStr>::Err: std::fmt::Debug, { let mut b = String::new(); std::io::stdin().read_line(&mut b).unwrap(); b.trim().parse().unwrap() } fn dfs(d: i32, cx: i32, cy: i32) -> bool { if cx == 0 && cy == 0 { return true; } if d == 0 { return false; } for dx in (-2)..3 { for dy in (-2)..3 { if (dx as i32).abs() + (dy as i32).abs() != 3 { continue; } if dfs(d - 1, cx + dx, cy + dy) { return true; } } } false } fn main() { let mut b = String::new(); std::io::stdin().read_line(&mut b).unwrap(); let iv: Vec<i32> = b .split(' ') .map(|x| x.trim().parse::<i32>().unwrap()) .collect(); let (x, y) = (iv[0], iv[1]); println!("{}", if dfs(3, x, y) { "YES" } else { "NO" }) }