結果
| 問題 | No.13 囲みたい! | 
| コンテスト | |
| ユーザー |  aimy | 
| 提出日時 | 2017-05-11 16:38:51 | 
| 言語 | Haskell (9.10.1) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 611 bytes | 
| コンパイル時間 | 8,003 ms | 
| コンパイル使用メモリ | 178,048 KB | 
| 実行使用メモリ | 14,336 KB | 
| 最終ジャッジ日時 | 2024-09-15 08:05:16 | 
| 合計ジャッジ時間 | 10,705 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 TLE * 1 -- * 10 | 
コンパイルメッセージ
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
ソースコード
import Data.Bool import Data.List main = do [w,h] <- map read . words <$> getLine ms <- map read . words <$> getContents :: IO [Int] putStrLn (bool "impossible" "possible" (anyClosed w h ms)) anyClosed w h ms = or (unfoldr (isClosed w) ims) where ims = zip [i | i<-[1..(w+1)*h], mod i (w+1) /= 0] ms isClosed w [] = Nothing isClosed w ((i,m):ims) = Just (dfs w [i,i] is, ims) where is = map fst (filter ((==m) . snd) ((i,m):ims)) dfs w acc@(a:a':as) is | null is = False | notElem a is = False | elem a as = True | otherwise = or (map (\i -> dfs w (i:acc) is) (delete a' [a-1,a+1,a-(w+1),a+(w+1)]))
