結果

問題 No.179 塗り分け
ユーザー ducktailducktail
提出日時 2018-08-01 16:27:38
言語 Haskell
(9.8.2)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 703 bytes
コンパイル時間 2,663 ms
コンパイル使用メモリ 158,732 KB
実行使用メモリ 11,440 KB
最終ジャッジ日時 2023-09-30 21:03:36
合計ジャッジ時間 10,151 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,064 KB
testcase_01 AC 3 ms
7,032 KB
testcase_02 AC 3 ms
7,124 KB
testcase_03 AC 3 ms
7,032 KB
testcase_04 AC 2 ms
7,080 KB
testcase_05 AC 32 ms
11,200 KB
testcase_06 AC 3 ms
7,180 KB
testcase_07 AC 3 ms
7,264 KB
testcase_08 AC 3 ms
7,856 KB
testcase_09 AC 4 ms
7,824 KB
testcase_10 AC 6 ms
7,920 KB
testcase_11 AC 6 ms
7,876 KB
testcase_12 TLE -
testcase_13 AC 2 ms
7,064 KB
testcase_14 AC 2 ms
7,080 KB
testcase_15 AC 3 ms
6,904 KB
testcase_16 AC 3 ms
7,064 KB
testcase_17 AC 2 ms
6,980 KB
testcase_18 AC 12 ms
8,304 KB
testcase_19 AC 12 ms
8,248 KB
testcase_20 AC 592 ms
11,284 KB
testcase_21 AC 42 ms
11,140 KB
testcase_22 AC 42 ms
11,160 KB
testcase_23 AC 4 ms
7,492 KB
testcase_24 AC 32 ms
10,796 KB
testcase_25 AC 4 ms
7,372 KB
testcase_26 AC 11 ms
7,972 KB
testcase_27 AC 112 ms
11,316 KB
testcase_28 AC 12 ms
8,200 KB
testcase_29 AC 202 ms
11,332 KB
testcase_30 AC 92 ms
11,308 KB
testcase_31 AC 272 ms
11,336 KB
testcase_32 AC 72 ms
11,316 KB
testcase_33 AC 372 ms
11,280 KB
testcase_34 AC 52 ms
11,348 KB
testcase_35 AC 462 ms
11,416 KB
testcase_36 AC 2 ms
7,016 KB
testcase_37 AC 2 ms
7,092 KB
testcase_38 AC 3 ms
7,060 KB
testcase_39 AC 3 ms
7,040 KB
testcase_40 AC 3 ms
7,132 KB
testcase_41 AC 2 ms
7,100 KB
testcase_42 AC 3 ms
7,200 KB
testcase_43 AC 8 ms
8,872 KB
testcase_44 AC 32 ms
11,248 KB
testcase_45 AC 3 ms
7,316 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative ((<$>))
import Control.Monad (replicateM, guard)
import Data.List (delete)

main :: IO ()
main = do
  [h, w] <- map read <$> words <$> getLine
  solve h w <$> replicateM h getLine >>= putStrLn

solve :: Int -> Int -> [String] -> String
solve h w xs | null ls = "NO"
             | any (f ls) [(di,dj)| dj <- [0..h-1], di <- [1-w..w-1]] = "YES"
             | otherwise = "NO"
  where ls = do
          j <- [0..h-1]
          i <- [0..w-1]
          guard $ xs !! j !! i == '#'
          return (i, j)
        f [] (di, dj) = True
        f ((i, j):rs) (di, dj) | (i+di, j+dj) `elem` rs = f (delete (i+di, j+dj) rs) (di, dj)
                               | otherwise = False
0