結果

問題 No.228 ゆきこちゃんの 15 パズル
ユーザー tsuchinagatsuchinaga
提出日時 2019-04-10 15:22:16
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 13,597 ms
コンパイル使用メモリ 224,624 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 06:44:38
合計ジャッジ時間 13,624 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func main() {
	var a int
	nums := map[int]int{}

	cnt := 0
	for i := 1; i <= 4*4; i++ {
		_, _ = fmt.Scan(&a)
		nums[a] = i % 16
		if a == i%16 {
			cnt++
		}
	}

	// fmt.Println(nums)

	if nums[0] == 0 && cnt != 16 {
		fmt.Println("No")
		return
	}

	for nums[0] != 0 {
		c := nums[0]
		t := nums[nums[0]]
		if c-1 != t && c+1 != t && c-4 == t && c+4 == t {
			fmt.Println("No")
			return
		}

		nums[0], nums[nums[0]] = nums[nums[0]], nums[0]
		// fmt.Println(nums)
	}

	fmt.Println("Yes")
}
0