Submission #1480740


Source Code Expand

{-# LANGUAGE OverloadedStrings, ViewPatterns #-}
import Data.List
import qualified Data.ByteString.Char8 as B

main = breads >>= main'
    where
        main' [n, a, b] = B.getLine >>= mapM_ B.putStrLn . solve (a + b) b 0 0

solve :: Int -> Int -> Int -> Int -> B.ByteString -> [B.ByteString]
solve ab b tn n (B.uncons -> Just (x, xs))
    | x == 'a' && tn < ab = "Yes" : solve ab b (tn + 1) n xs
    | x == 'b' && tn < ab && n < b = "Yes" : solve ab b (tn + 1) (n + 1) xs
    | otherwise = "No" : solve ab b tn n xs
solve _ _ _ _ _ = []

breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)

Submission Info

Submission Time
Task B - Qualification simulator
User lodnix
Language Haskell (GHC 7.10.3)
Score 200
Code Size 756 Byte
Status AC
Exec Time 17 ms
Memory 1532 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 17 ms 1404 KB
02.txt AC 17 ms 1404 KB
03.txt AC 17 ms 1532 KB
04.txt AC 17 ms 1532 KB
05.txt AC 14 ms 1404 KB
06.txt AC 16 ms 1404 KB
07.txt AC 17 ms 1532 KB
08.txt AC 17 ms 1532 KB
09.txt AC 16 ms 1404 KB
10.txt AC 16 ms 1404 KB
s1.txt AC 1 ms 380 KB
s2.txt AC 1 ms 380 KB
s3.txt AC 1 ms 380 KB