結果

問題 No.179 塗り分け
ユーザー aimyaimy
提出日時 2017-05-01 19:11:29
言語 Haskell
(9.6.2)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 1,251 ms
コンパイル使用メモリ 160,228 KB
実行使用メモリ 12,096 KB
最終ジャッジ日時 2023-07-26 16:48:10
合計ジャッジ時間 17,904 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,708 KB
testcase_01 AC 4 ms
7,624 KB
testcase_02 AC 4 ms
8,060 KB
testcase_03 AC 3 ms
7,852 KB
testcase_04 AC 4 ms
8,232 KB
testcase_05 AC 3 ms
7,900 KB
testcase_06 WA -
testcase_07 AC 3 ms
7,708 KB
testcase_08 AC 4 ms
9,412 KB
testcase_09 AC 5 ms
9,480 KB
testcase_10 AC 613 ms
11,940 KB
testcase_11 AC 502 ms
11,968 KB
testcase_12 AC 1,682 ms
11,992 KB
testcase_13 AC 3 ms
8,516 KB
testcase_14 AC 3 ms
8,448 KB
testcase_15 AC 2 ms
7,680 KB
testcase_16 AC 3 ms
7,780 KB
testcase_17 AC 3 ms
7,416 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 3 ms
8,344 KB
testcase_21 AC 3 ms
8,024 KB
testcase_22 AC 163 ms
12,016 KB
testcase_23 AC 202 ms
11,920 KB
testcase_24 AC 133 ms
11,952 KB
testcase_25 AC 83 ms
12,028 KB
testcase_26 AC 183 ms
11,900 KB
testcase_27 AC 633 ms
11,972 KB
testcase_28 AC 452 ms
11,964 KB
testcase_29 AC 983 ms
11,956 KB
testcase_30 AC 373 ms
11,980 KB
testcase_31 AC 1,191 ms
12,024 KB
testcase_32 AC 463 ms
12,076 KB
testcase_33 AC 1,192 ms
12,096 KB
testcase_34 WA -
testcase_35 AC 1,373 ms
12,004 KB
testcase_36 AC 3 ms
7,904 KB
testcase_37 AC 3 ms
7,648 KB
testcase_38 AC 4 ms
7,992 KB
testcase_39 AC 3 ms
7,968 KB
testcase_40 AC 4 ms
8,392 KB
testcase_41 AC 3 ms
7,860 KB
testcase_42 AC 4 ms
8,396 KB
testcase_43 AC 22 ms
11,924 KB
testcase_44 AC 113 ms
11,992 KB
testcase_45 AC 12 ms
11,896 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 Data.Char
import Data.Bool
import Data.List
import Control.Monad
import qualified Data.IntSet as S

main = do
 [h,w] <- map read . words <$> getLine
 is <- map (\i -> i + w + ((div i w * 2) * w)) . findIndices (=='#') . filter isPrint <$> getContents
 putStrLn $ bool "NO" "YES" (dpaint h w (S.fromList is))

dpaint h w is
 | S.null is = False
 | odd (S.size is) = False
 | otherwise = or $ do
  d <- [negate (4*h*w-1) .. (4*h*w-1)]
  guard (d /= 0)
  let is' = S.map (+d) is
  let inter = S.intersection is is'
  let inter' = S.map (subtract d) inter
  guard $ S.null (S.intersection inter inter')
  return (S.union inter inter' == is)
0