結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー aimyaimy
提出日時 2017-04-30 10:39:50
言語 Haskell
(9.8.2)
結果
RE  
実行時間 -
コード長 690 bytes
コンパイル時間 7,386 ms
コンパイル使用メモリ 166,492 KB
実行使用メモリ 7,276 KB
最終ジャッジ日時 2023-10-11 23:32:12
合計ジャッジ時間 6,174 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 3 ms
7,040 KB
testcase_04 AC 3 ms
6,908 KB
testcase_05 AC 2 ms
6,996 KB
testcase_06 AC 3 ms
7,024 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 2 ms
7,048 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 2 ms
6,936 KB
testcase_30 AC 3 ms
6,988 KB
testcase_31 AC 2 ms
7,100 KB
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 3 ms
7,020 KB
testcase_35 AC 3 ms
6,992 KB
testcase_36 RE -
testcase_37 AC 3 ms
7,052 KB
testcase_38 AC 3 ms
7,072 KB
testcase_39 RE -
testcase_40 AC 2 ms
7,000 KB
testcase_41 RE -
testcase_42 RE -
testcase_43 AC 3 ms
7,124 KB
testcase_44 AC 3 ms
7,000 KB
testcase_45 AC 2 ms
7,056 KB
testcase_46 AC 2 ms
6,968 KB
testcase_47 RE -
testcase_48 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.List
import Control.Monad

main = do
 d <- readLn
 cs <- map (\c -> if c=='o' then True else False) . filter isAlpha <$> getContents
 print (gw2 d cs)

gw2 :: Int -> [Bool] -> Int 
gw2 d cs = maximum [chead, clast, maximum cinter]
 where
  chead = maximum $ map length $ filter head $ group $ replicate d True ++ cs
  clast = maximum $ map length $ filter head $ group $ cs ++ replicate d True
  cinter = do
   i <- [0..13-d]
   let pat = replicate i False ++ replicate d True ++ replicate (14-(d+i)) False
   let cs' = zipWith (||) pat cs
   guard (length (filter id cs') == length (filter id cs) + d)
   return $ maximum $ map length $ filter head $ group cs'
0