Typical DP Contest

Submission #5410018

Source codeソースコード

import qualified Control.Monad as M
import qualified Data.Map as Map
import qualified Data.Set as S
import qualified Data.Array as A

type IntSet = S.Set Int

main = do
    n <- readLn :: IO Int
    ps <- map read . words <$> getLine
    print $ solve n ps

solve :: Int -> [Int] -> Int
solve n ps = length $ g ps

g :: [Int] -> IntSet
g (p:[]) = S.fromList [0, p]
g (p:ps) = S.union s (S.map (+p) s) where
    s = g ps

Submission

Task問題 A - コンテスト
User nameユーザ名 yk
Created time投稿日時
Language言語 Haskell (GHC 7.10.3)
Status状態 AC
Score得点 2
Source lengthソースコード長 439 Byte
File nameファイル名
Exec time実行時間 80 ms
Memory usageメモリ使用量 3324 KB

Test case

Set

Set name Score得点 / Max score Cases
All 2 / 2 00,01,02,90,91

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00 AC 2 ms 636 KB
01 AC 16 ms 1532 KB
02 AC 80 ms 3324 KB
90 AC 1 ms 508 KB
91 AC 1 ms 508 KB