結果

問題 No.156 キャンディー・ボックス
ユーザー はむ吉🐹はむ吉🐹
提出日時 2015-10-18 19:34:41
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 893 ms
コンパイル使用メモリ 164,860 KB
実行使用メモリ 11,500 KB
最終ジャッジ日時 2023-09-29 00:07:45
合計ジャッジ時間 6,455 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
11,416 KB
testcase_01 AC 3 ms
7,324 KB
testcase_02 AC 2 ms
7,188 KB
testcase_03 AC 3 ms
7,256 KB
testcase_04 AC 2 ms
7,328 KB
testcase_05 AC 32 ms
11,376 KB
testcase_06 AC 63 ms
11,428 KB
testcase_07 AC 62 ms
11,368 KB
testcase_08 AC 42 ms
11,404 KB
testcase_09 AC 32 ms
11,420 KB
testcase_10 AC 52 ms
11,364 KB
testcase_11 AC 32 ms
11,444 KB
testcase_12 AC 72 ms
11,404 KB
testcase_13 AC 42 ms
11,388 KB
testcase_14 AC 32 ms
11,408 KB
testcase_15 AC 52 ms
11,428 KB
testcase_16 AC 32 ms
11,428 KB
testcase_17 AC 42 ms
11,408 KB
testcase_18 AC 22 ms
11,392 KB
testcase_19 AC 32 ms
11,424 KB
testcase_20 AC 5 ms
9,320 KB
testcase_21 AC 12 ms
11,364 KB
testcase_22 AC 22 ms
11,400 KB
testcase_23 AC 12 ms
11,344 KB
testcase_24 AC 2 ms
7,108 KB
testcase_25 AC 3 ms
7,088 KB
testcase_26 AC 2 ms
7,260 KB
testcase_27 AC 3 ms
7,336 KB
testcase_28 AC 3 ms
7,164 KB
testcase_29 AC 3 ms
7,168 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List (sort)
import Control.Applicative ((<$>))

empty = 100001 :: Int

pickCandy :: [Int] -> [Int]
pickCandy cs
    | c' > 0    = c' : cr
    | otherwise = empty : cr
    where
        (c : cr) = sort cs
        c' = c - 1

pickCandies :: Int -> [Int] -> [Int]
pickCandies 0 cs = cs
pickCandies m cs = pickCandies (m - 1) $ pickCandy cs

main :: IO ()
main = do
    (_ : m : _) <- map read . words <$> getLine
    print . length . filter (== empty) . pickCandies m . map read . words =<< getLine
0