結果

問題 No.2424 Josouzai
ユーザー ducktailducktail
提出日時 2023-08-20 17:32:04
言語 Haskell
(9.8.2)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 13,420 ms
コンパイル使用メモリ 180,980 KB
実行使用メモリ 24,832 KB
最終ジャッジ日時 2024-05-07 23:57:37
合計ジャッジ時間 17,228 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 23 ms
12,672 KB
testcase_05 AC 67 ms
24,576 KB
testcase_06 AC 68 ms
24,832 KB
testcase_07 AC 56 ms
24,704 KB
testcase_08 AC 50 ms
24,704 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 13 ms
12,032 KB
testcase_11 AC 29 ms
18,816 KB
testcase_12 AC 24 ms
16,128 KB
testcase_13 AC 17 ms
12,544 KB
testcase_14 AC 22 ms
14,208 KB
testcase_15 AC 5 ms
7,808 KB
testcase_16 AC 43 ms
23,808 KB
testcase_17 AC 11 ms
10,624 KB
testcase_18 AC 15 ms
12,416 KB
testcase_19 AC 20 ms
13,824 KB
testcase_20 AC 42 ms
23,808 KB
testcase_21 AC 31 ms
16,640 KB
testcase_22 AC 17 ms
12,672 KB
testcase_23 AC 17 ms
12,544 KB
testcase_24 AC 8 ms
9,472 KB
testcase_25 AC 49 ms
24,448 KB
testcase_26 AC 31 ms
16,896 KB
testcase_27 AC 49 ms
24,448 KB
testcase_28 AC 44 ms
23,424 KB
testcase_29 AC 31 ms
16,896 KB
testcase_30 AC 10 ms
10,496 KB
testcase_31 AC 21 ms
13,824 KB
testcase_32 AC 46 ms
24,320 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/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