結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー aimyaimy
提出日時 2018-02-03 10:47:02
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 7,295 ms
コンパイル使用メモリ 162,780 KB
実行使用メモリ 7,336 KB
最終ジャッジ日時 2023-09-02 08:23:36
合計ジャッジ時間 4,966 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,184 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
7,092 KB
testcase_04 AC 3 ms
7,188 KB
testcase_05 AC 3 ms
7,036 KB
testcase_06 AC 3 ms
7,084 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
7,136 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 3 ms
7,096 KB
testcase_26 AC 3 ms
7,124 KB
testcase_27 AC 3 ms
7,208 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 2 ms
7,156 KB
testcase_31 AC 3 ms
7,016 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 2 ms
7,212 KB
testcase_35 AC 3 ms
7,040 KB
testcase_36 AC 3 ms
7,140 KB
testcase_37 AC 2 ms
7,148 KB
testcase_38 AC 3 ms
7,084 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
7,036 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 2 ms
7,032 KB
testcase_45 AC 2 ms
7,032 KB
testcase_46 AC 2 ms
7,160 KB
testcase_47 WA -
testcase_48 AC 2 ms
7,216 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.List

main = do
  d <- readLn
  cs <- concat . words <$> getContents
  let
    gs = (map length . group) cs
    ans = case (length gs, head cs) of
      (1, 'o') -> 14
      (1, 'x') -> d
      (2, 'o') -> min 14 (last gs + d)
      (2, 'x') -> min 14 (head gs + d)
      (3, 'o') -> let [x,y,z] = gs in if d>=y then x+y+z else max x z + y
      (3, 'x') -> let [x,y,z] = gs in max (y + min x d) (y + min z d)
      (_, 'o') -> maximum (iFilter even (zipWith3 (\x y z -> if d>=y then x+y+z else max x z + d) gs (drop 1 gs) (drop 2 gs)))
      (_, 'x') -> maximum (iFilter odd (zipWith3 (\x y z -> if d>=y then x+y+z else max x z + d) gs (drop 1 gs) (drop 2 gs)))
  print ans

iFilter p xs = [x | (i,x) <- zip [0..] xs, p i]
0