結果
問題 |
No.240 ナイト散歩
|
ユーザー |
![]() |
提出日時 | 2019-03-20 13:00:45 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 15,726 ms |
コンパイル使用メモリ | 219,592 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-18 21:47:50 |
合計ジャッジ時間 | 16,240 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
package main import "fmt" func main() { var x, y int _, _ = fmt.Scan(&x, &y) type m struct { x, y int } move := []m{{2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}, {-2, 1}, {-1, 2}, {1, 2}} pos := map[m]int{m{0, 0}: 1} for i := 0; i < 3; i++ { tmp := make(map[m]int, 0) for p := range pos { for _, a := range move { if p.x+a.x == x && p.y+a.y == y { fmt.Println("YES") return } tmp[m{p.x + a.x, p.y + a.y}] = 1 } } pos = tmp // fmt.Println(pos) } fmt.Println("NO") }