結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2022-12-23 22:38:32 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 820 bytes |
コンパイル時間 | 17,591 ms |
コンパイル使用メモリ | 391,736 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 04:36:10 |
合計ジャッジ時間 | 12,820 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
use std::collections::HashSet;fn main() {let mut xx = String::new();std::io::stdin().read_line(&mut xx).ok();let xx: Vec<i64> = xx.split_whitespace().flat_map(str::parse).collect();let mut coord: HashSet<_> = std::iter::once((0, 0)).collect();for _ in 0..3 {let mut new_coord = coord.clone();for &(x, y) in &coord {new_coord.extend([(x - 2, y - 1),(x - 2, y + 1),(x - 1, y - 2),(x - 1, y + 2),(x + 1, y - 2),(x + 1, y + 2),(x + 2, y - 1),(x + 2, y + 1),]);}coord = new_coord;}if coord.contains(&(xx[0], xx[1])) {println!("YES");} else {println!("NO");}}