Submission #1104117


Source Code Expand

Copy
import Control.Applicative
import Control.Monad
import Data.List
main = getLine >>= main' . map read . words >>= putStrLn
    where
        main' [n, m] = solve (n - m + 1) <$> replicateM n getLine <*> replicateM m getLine

solve :: Int -> [String] -> [String] -> String
solve c as bs
    | res = "Yes"
    | otherwise = "No"
    where
        res = recf c as
        recf 0 _ = False
        recf n xs
            | r = True
            | otherwise = recf (n - 1) $ tail xs
            where
                r = reccolf c xs

        reccolf 0 _ = False
        reccolf n xs
            | r = True
            | otherwise = reccolf (n - 1) $ map tail xs
            where
                r = all ff $ zip bs xs
                ff (b, x) = b `isPrefixOf` x

Submission Info

Submission Time
Task B - Template Matching
User lodnix
Language Haskell (GHC 7.10.3)
Score 200
Code Size 784 Byte
Status
Exec Time 2 ms
Memory 892 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 200 / 200 sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt
Case Name Status Exec Time Memory
sample_01.txt 1 ms 508 KB
sample_02.txt 1 ms 508 KB
subtask_1_01.txt 1 ms 508 KB
subtask_1_02.txt 1 ms 508 KB
subtask_1_03.txt 1 ms 508 KB
subtask_1_04.txt 1 ms 508 KB
subtask_1_05.txt 2 ms 892 KB
subtask_1_06.txt 2 ms 764 KB
subtask_1_07.txt 2 ms 764 KB
subtask_1_08.txt 1 ms 636 KB