結果
問題 | No.380 悪の台本 |
ユーザー | aimy |
提出日時 | 2017-04-28 21:25:52 |
言語 | Haskell (9.8.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 837 bytes |
コンパイル時間 | 1,891 ms |
コンパイル使用メモリ | 170,624 KB |
実行使用メモリ | 8,960 KB |
最終ジャッジ日時 | 2024-11-06 23:22:33 |
合計ジャッジ時間 | 2,532 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | RE | - |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | RE | - |
testcase_08 | AC | 16 ms
8,960 KB |
testcase_09 | RE | - |
コンパイルメッセージ
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:49: 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 | | otherwise = if null ps then [xs] else (xs \\ head ps) : splitBy p (head ps) | ^^^^ Main.hs:8:71: 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 | | otherwise = if null ps then [xs] else (xs \\ head ps) : splitBy p (head ps) | ^^^^ Main.hs:13:19: 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." | 13 | daihon str = case head (words str) of | ^^^^ [2 of 2] Linking a.out
ソースコード
import Data.Char import Data.Bool import Data.List splitBy p xs | null xs = [] | isPrefixOf p xs = splitBy p (xs \\ p) | otherwise = if null ps then [xs] else (xs \\ head ps) : splitBy p (head ps) where ps = filter (isPrefixOf p) (tails xs) main = interact $ unlines . map (bool "WRONG!" "CORRECT (maybe)" . daihon) . lines . map toLower daihon str = case head (words str) of "digi" -> let suf = last (splitBy "nyo" (str++"!")) in length suf <=4 && all isSym suf "petit" -> let suf = last (splitBy "nyu" (str++"!")) in length suf <=4 && all isSym suf "rabi" -> any isPunctuation str "gema" -> let suf = last (splitBy "gema" (str++"!")) in length suf <=4 && all isSym suf "piyo" -> let suf = last (splitBy "pyo" (str++"!")) in length suf <=4 && all isSym suf isSym c = (not.isAlpha) c && (not.isDigit) c && isPrint c