結果

問題 No.2424 Josouzai
ユーザー ducktailducktail
提出日時 2023-08-20 17:32:04
言語 Haskell
(9.8.2)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 12,441 ms
コンパイル使用メモリ 163,388 KB
実行使用メモリ 27,780 KB
最終ジャッジ日時 2023-08-20 17:32:26
合計ジャッジ時間 15,831 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,308 KB
testcase_01 AC 2 ms
7,096 KB
testcase_02 AC 2 ms
7,224 KB
testcase_03 AC 2 ms
7,108 KB
testcase_04 AC 22 ms
14,852 KB
testcase_05 AC 52 ms
25,772 KB
testcase_06 AC 52 ms
25,776 KB
testcase_07 AC 52 ms
25,704 KB
testcase_08 AC 52 ms
25,860 KB
testcase_09 AC 2 ms
7,108 KB
testcase_10 AC 22 ms
16,084 KB
testcase_11 AC 42 ms
27,780 KB
testcase_12 AC 22 ms
18,688 KB
testcase_13 AC 22 ms
15,228 KB
testcase_14 AC 32 ms
17,704 KB
testcase_15 AC 7 ms
12,376 KB
testcase_16 AC 52 ms
25,780 KB
testcase_17 AC 22 ms
14,832 KB
testcase_18 AC 22 ms
14,820 KB
testcase_19 AC 32 ms
16,780 KB
testcase_20 AC 52 ms
25,700 KB
testcase_21 AC 42 ms
25,496 KB
testcase_22 AC 22 ms
14,756 KB
testcase_23 AC 22 ms
15,524 KB
testcase_24 AC 12 ms
13,800 KB
testcase_25 AC 52 ms
25,776 KB
testcase_26 AC 42 ms
25,520 KB
testcase_27 AC 52 ms
25,768 KB
testcase_28 AC 52 ms
25,812 KB
testcase_29 AC 42 ms
25,456 KB
testcase_30 AC 12 ms
13,888 KB
testcase_31 AC 22 ms
16,044 KB
testcase_32 AC 52 ms
25,864 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 Control.Monad
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = do
  [n, k] <- f
  unwords <$> map show <$> solve k <$> f >>= putStrLn
  where
    f = readil B.readInt <$> B.getLine

solve :: Int -> [Int] -> [Int]
solve k as = [length l, k - last l]
  where
    l = takeWhile (<= k) $ scanl1 (+) $ sort as

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr $ f . B.dropWhile isSpace
0