結果
問題 |
No.430 文字列検索
|
ユーザー |
![]() |
提出日時 | 2017-05-17 10:16:02 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 1,458 ms / 2,000 ms |
コード長 | 333 bytes |
コンパイル時間 | 2,253 ms |
コンパイル使用メモリ | 180,832 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-10 00:15:41 |
合計ジャッジ時間 | 17,498 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Monad import Data.List import qualified Data.ByteString.Char8 as B main = do s <- B.getLine getLine cs <- B.lines <$> B.getContents print (searchString s cs) searchString s = sum . map (match s) match s c = length $ filter id $ unfoldr (\s' -> guard (not (B.null s')) >> return (B.isPrefixOf c s', B.tail s')) s