結果

問題 No.549 素材合成システム
ユーザー ducktailducktail
提出日時 2018-04-24 13:26:32
言語 Haskell
(9.8.2)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 565 bytes
コンパイル時間 4,586 ms
コンパイル使用メモリ 164,972 KB
実行使用メモリ 17,160 KB
最終ジャッジ日時 2023-09-09 23:27:37
合計ジャッジ時間 6,196 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,328 KB
testcase_01 AC 3 ms
7,292 KB
testcase_02 AC 2 ms
7,276 KB
testcase_03 AC 2 ms
7,320 KB
testcase_04 AC 2 ms
7,356 KB
testcase_05 AC 2 ms
7,328 KB
testcase_06 AC 2 ms
7,404 KB
testcase_07 AC 22 ms
17,060 KB
testcase_08 AC 22 ms
17,028 KB
testcase_09 AC 22 ms
17,024 KB
testcase_10 AC 22 ms
16,956 KB
testcase_11 AC 23 ms
17,020 KB
testcase_12 AC 22 ms
17,016 KB
testcase_13 AC 22 ms
17,080 KB
testcase_14 AC 22 ms
17,008 KB
testcase_15 AC 22 ms
17,040 KB
testcase_16 AC 22 ms
16,956 KB
testcase_17 AC 22 ms
14,632 KB
testcase_18 AC 22 ms
14,568 KB
testcase_19 AC 22 ms
14,628 KB
testcase_20 AC 22 ms
14,584 KB
testcase_21 AC 22 ms
16,584 KB
testcase_22 AC 23 ms
17,160 KB
testcase_23 AC 22 ms
16,804 KB
testcase_24 AC 22 ms
16,128 KB
testcase_25 AC 22 ms
16,076 KB
testcase_26 AC 22 ms
16,648 KB
testcase_27 AC 22 ms
16,016 KB
testcase_28 AC 3 ms
7,360 KB
testcase_29 AC 3 ms
7,284 KB
testcase_30 AC 2 ms
7,384 KB
testcase_31 AC 22 ms
14,648 KB
testcase_32 AC 22 ms
14,524 KB
testcase_33 AC 23 ms
14,612 KB
testcase_34 AC 22 ms
14,600 KB
testcase_35 AC 22 ms
17,068 KB
testcase_36 AC 22 ms
14,536 KB
testcase_37 AC 22 ms
14,532 KB
testcase_38 AC 2 ms
7,348 KB
testcase_39 AC 2 ms
7,356 KB
testcase_40 AC 22 ms
14,892 KB
testcase_41 AC 12 ms
12,792 KB
testcase_42 AC 3 ms
7,832 KB
testcase_43 AC 12 ms
12,120 KB
testcase_44 AC 4 ms
9,192 KB
testcase_45 AC 12 ms
12,268 KB
testcase_46 AC 12 ms
12,148 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.Applicative ((<$>))

import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

import Data.List (unfoldr, delete)
import Data.Char (isSpace)

main :: IO ()
main = do
  getLine
  solve <$> readil B.readInt <$> B.getLine >>= print

solve :: [Int] -> Int
solve xs = mx + (sum . map (flip div 2) $ delete mx xs)
  where mx = maximum xs

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where
    g s = do
      (n, s') <- f s
      return (n, B.dropWhile isSpace s')
0