結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー aimyaimy
提出日時 2017-04-30 10:58:20
言語 Haskell
(9.6.2)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 5,644 ms
コンパイル使用メモリ 164,868 KB
実行使用メモリ 7,212 KB
最終ジャッジ日時 2023-10-11 23:32:34
合計ジャッジ時間 2,839 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
7,120 KB
testcase_02 AC 2 ms
7,060 KB
testcase_03 AC 2 ms
7,096 KB
testcase_04 AC 2 ms
7,108 KB
testcase_05 AC 3 ms
7,064 KB
testcase_06 AC 2 ms
7,076 KB
testcase_07 AC 2 ms
7,104 KB
testcase_08 AC 2 ms
7,180 KB
testcase_09 AC 2 ms
7,136 KB
testcase_10 AC 3 ms
7,116 KB
testcase_11 AC 2 ms
7,144 KB
testcase_12 AC 2 ms
7,076 KB
testcase_13 AC 2 ms
7,116 KB
testcase_14 AC 3 ms
7,092 KB
testcase_15 AC 2 ms
7,104 KB
testcase_16 AC 3 ms
7,172 KB
testcase_17 AC 3 ms
7,144 KB
testcase_18 AC 3 ms
7,116 KB
testcase_19 AC 3 ms
7,136 KB
testcase_20 AC 2 ms
7,124 KB
testcase_21 AC 2 ms
7,088 KB
testcase_22 AC 3 ms
7,160 KB
testcase_23 AC 3 ms
7,076 KB
testcase_24 AC 2 ms
7,040 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 3 ms
7,056 KB
testcase_29 AC 3 ms
7,060 KB
testcase_30 AC 2 ms
7,140 KB
testcase_31 AC 3 ms
7,128 KB
testcase_32 AC 3 ms
7,120 KB
testcase_33 AC 2 ms
7,044 KB
testcase_34 AC 3 ms
7,136 KB
testcase_35 AC 3 ms
7,096 KB
testcase_36 RE -
testcase_37 AC 3 ms
7,124 KB
testcase_38 AC 3 ms
7,080 KB
testcase_39 AC 3 ms
7,060 KB
testcase_40 AC 3 ms
7,108 KB
testcase_41 WA -
testcase_42 AC 2 ms
7,124 KB
testcase_43 AC 2 ms
7,032 KB
testcase_44 AC 2 ms
7,104 KB
testcase_45 AC 2 ms
7,000 KB
testcase_46 AC 3 ms
7,040 KB
testcase_47 AC 3 ms
7,148 KB
testcase_48 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 (0:cinter)]
 where
  chead = maximum $ map length $ filter head $ group $ replicate d True ++ dropWhile not cs
  clast = maximum $ map length $ filter head $ group $ (reverse . dropWhile not . reverse) cs ++ replicate d True
  cinter = do
   i <- [0 .. 14-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 $ (0:) $ map length $ filter head $ group cs'
0