You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where import Control.Monad (replicateM, replicateM_) import qualified Data.Map as M main :: IO () main = do n <- readLn :: IO Int ds <- replicateM n getLine let dm = M.fromListWith (+) $ map (\s -> (s,1)) ds q <- readLn :: IO Int replicateM_ q $ do s <- getLine print $ M.findWithDefault 0 s dm
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
Haskell