結果

問題 No.5 数字のブロック
ユーザー jugemjugemjugemjugemjugemjugem
提出日時 2017-10-28 21:25:25
言語 Haskell
(9.8.2)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 3,143 ms
コンパイル使用メモリ 162,696 KB
実行使用メモリ 14,728 KB
最終ジャッジ日時 2023-08-11 17:53:15
合計ジャッジ時間 2,855 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,104 KB
testcase_01 AC 3 ms
7,144 KB
testcase_02 AC 2 ms
6,976 KB
testcase_03 AC 32 ms
13,460 KB
testcase_04 AC 23 ms
12,572 KB
testcase_05 AC 32 ms
13,764 KB
testcase_06 AC 23 ms
12,656 KB
testcase_07 AC 22 ms
12,412 KB
testcase_08 AC 32 ms
12,940 KB
testcase_09 AC 12 ms
11,532 KB
testcase_10 AC 43 ms
14,376 KB
testcase_11 AC 22 ms
12,060 KB
testcase_12 AC 32 ms
13,216 KB
testcase_13 AC 32 ms
14,044 KB
testcase_14 AC 3 ms
7,836 KB
testcase_15 AC 4 ms
8,508 KB
testcase_16 AC 32 ms
13,616 KB
testcase_17 AC 42 ms
14,096 KB
testcase_18 AC 42 ms
13,772 KB
testcase_19 AC 43 ms
14,728 KB
testcase_20 AC 3 ms
7,100 KB
testcase_21 AC 2 ms
7,080 KB
testcase_22 AC 3 ms
7,072 KB
testcase_23 AC 3 ms
7,148 KB
testcase_24 AC 4 ms
8,796 KB
testcase_25 AC 6 ms
10,452 KB
testcase_26 AC 3 ms
7,104 KB
testcase_27 AC 3 ms
7,036 KB
testcase_28 AC 3 ms
6,988 KB
testcase_29 AC 22 ms
12,712 KB
testcase_30 AC 12 ms
11,712 KB
testcase_31 AC 2 ms
7,116 KB
testcase_32 AC 3 ms
7,044 KB
testcase_33 AC 3 ms
7,060 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Control.Monad
import Control.Applicative
import Data.List

main = do
  l <- readLn
  n <- readLn
  w <- map read . words <$> getLine
  -- [w] <- map read . words <$> getLine

  putStrLn . show $ solve l n w

solve :: Int -> Int -> [Int] -> Int
solve l n w = length . foldr (\x acc -> if x + sum acc <= l then x:acc else acc) [] . reverse $ sort w
0