結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー | aimy |
提出日時 | 2018-02-03 10:54:57 |
言語 | Haskell (9.8.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 735 bytes |
コンパイル時間 | 1,461 ms |
コンパイル使用メモリ | 173,440 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-11 15:19:19 |
合計ジャッジ時間 | 2,357 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 1 ms
5,376 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 | 1 ms
5,376 KB |
testcase_26 | AC | 1 ms
5,376 KB |
testcase_27 | AC | 1 ms
5,376 KB |
testcase_28 | WA | - |
testcase_29 | AC | 1 ms
5,376 KB |
testcase_30 | AC | 1 ms
5,376 KB |
testcase_31 | AC | 1 ms
5,376 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | AC | 1 ms
5,376 KB |
testcase_35 | AC | 1 ms
5,376 KB |
testcase_36 | AC | 1 ms
5,376 KB |
testcase_37 | AC | 2 ms
5,376 KB |
testcase_38 | AC | 1 ms
5,376 KB |
testcase_39 | WA | - |
testcase_40 | AC | 1 ms
5,376 KB |
testcase_41 | AC | 2 ms
5,376 KB |
testcase_42 | WA | - |
testcase_43 | AC | 1 ms
5,376 KB |
testcase_44 | AC | 1 ms
5,376 KB |
testcase_45 | AC | 1 ms
5,376 KB |
testcase_46 | AC | 1 ms
5,376 KB |
testcase_47 | WA | - |
testcase_48 | AC | 1 ms
5,376 KB |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:8:28: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Data.List, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 8 | ans = case (length gs, head cs) of | ^^^^ Main.hs:12:27: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Data.List, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 12 | (2, 'x') -> min 14 (head gs + d) | ^^^^ [2 of 2] Linking a.out
ソースコード
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]