結果

問題 No.380 悪の台本
ユーザー aimyaimy
提出日時 2017-05-02 15:31:07
言語 Haskell
(9.8.2)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 933 bytes
コンパイル時間 4,199 ms
コンパイル使用メモリ 159,456 KB
実行使用メモリ 11,464 KB
最終ジャッジ日時 2023-08-06 20:18:11
合計ジャッジ時間 1,715 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,688 KB
testcase_01 AC 3 ms
6,856 KB
testcase_02 AC 3 ms
6,952 KB
testcase_03 AC 2 ms
6,832 KB
testcase_04 AC 12 ms
11,084 KB
testcase_05 AC 22 ms
11,096 KB
testcase_06 AC 22 ms
11,132 KB
testcase_07 AC 32 ms
10,944 KB
testcase_08 AC 22 ms
11,464 KB
testcase_09 AC 12 ms
11,120 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.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)

isSym c = (not.isAlphaNum) c && isPrint c 

main = interact $ unlines . map (bool "WRONG!" "CORRECT (maybe)" . daihon) . lines

daihon str = case span (/= ' ') str of
 ("digi",  (' ':srf)) -> (isSuffixOf "nyo")  $ map toLower $ reverse $ dropWhile isSym $ take 6 $ reverse srf
 ("petit", (' ':srf)) -> (isSuffixOf "nyu")  $ map toLower $ reverse $ dropWhile isSym $ take 6 $ reverse srf
 ("rabi",  (' ':srf)) -> any isAlphaNum srf
 ("gema",  (' ':srf)) -> (isSuffixOf "gema") $ map toLower $ reverse $ dropWhile isSym $ take 7 $ reverse srf
 ("piyo",  (' ':srf)) -> (isSuffixOf "pyo")  $ map toLower $ reverse $ dropWhile isSym $ take 6 $ reverse srf
 (_,(' ':"")) -> False
 _ -> False
0