結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,228 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 3 ms
7,168 KB
testcase_04 AC 3 ms
7,140 KB
testcase_05 AC 2 ms
7,024 KB
testcase_06 AC 3 ms
7,136 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
7,016 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 2 ms
7,012 KB
testcase_26 AC 3 ms
7,192 KB
testcase_27 AC 2 ms
7,040 KB
testcase_28 WA -
testcase_29 AC 3 ms
7,020 KB
testcase_30 AC 3 ms
7,120 KB
testcase_31 AC 2 ms
7,076 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 2 ms
7,128 KB
testcase_35 AC 2 ms
7,164 KB
testcase_36 AC 2 ms
7,024 KB
testcase_37 AC 2 ms
7,092 KB
testcase_38 AC 3 ms
7,096 KB
testcase_39 WA -
testcase_40 AC 2 ms
7,060 KB
testcase_41 AC 2 ms
7,020 KB
testcase_42 WA -
testcase_43 AC 2 ms
7,172 KB
testcase_44 AC 2 ms
7,072 KB
testcase_45 AC 2 ms
7,084 KB
testcase_46 AC 3 ms
7,176 KB
testcase_47 WA -
testcase_48 AC 3 ms
7,092 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 + d
      (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