結果

問題 No.228 ゆきこちゃんの 15 パズル
ユーザー aimy
提出日時 2017-07-22 22:35:34
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 5,709 ms
コンパイル使用メモリ 178,448 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 10:02:59
合計ジャッジ時間 8,162 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List
import Data.Bool
import Data.Maybe

main = do
  as <- map read . words <$> getContents
  let ias = zip ([1..15]++[0]) as
  putStrLn $ bool "No" "Yes" (sim 0 ias)

sim c ias
  | all (uncurry (==)) ias = True
  | otherwise = maybe False (\(i,_) -> sim i (delete (fromJust next) ias)) next
  where
    next = find (\(_,a) -> a == c) ias
0